From: Preston Pan Date: Fri, 19 Sep 2025 05:33:36 +0000 (-0700) Subject: big refactor X-Git-Url: https://ret2pop.net/gitweb/%22../index.html/%22https:/static/style.css?a=commitdiff_plain;h=bb31a5a879154432e11a75e69070b58004ddc07b;p=monorepo.git big refactor --- diff --git a/README.org b/README.org index b71c140..433b5d7 100644 --- a/README.org +++ b/README.org @@ -14,18 +14,25 @@ By using the ~org-publish~ function, ~org-roam~, and ~org-journal~, as well as writing a lot of things with a literate config. To see more, see my [[file:config/emacs.org][emacs configuration]] and my [[file:config/nix.org][NixOS configuration]]. ** So, where is this website of yours located? -https://ret2pop.nullring.xyz, it is the road to enlightenment. +https://ret2pop.net, it is the road to enlightenment. * Wait, so where are your dotfiles? To use my dotfiles, download the ISO image for the installer, log in, and run: #+begin_src bash - SYSTEM=continuity DRIVE=sda-simple nix_installer + nix_installer #+end_src then reboot, and run: #+begin_src bash cd $HOME/monorepo && git pull #+end_src +That's all! Note that if you install with an encrypted disk, you will have to run: +#+begin_src bash + echo "password123" > /tmp/secret.key +#+end_src +first. ** Post-setup In emacs, run ~M-x all-the-icons-install-fonts, ~~M-x nerd-icons-install-fonts~, and ~M-x org-roam-db-sync~. Install your music to ~$HOME/music~ for -emms. +emms. In firefox, go to the three-bar menu and enable all the add-ons that were automatically installed. Set up the ~mu~ program in order to +send and receive email, along with modifying the corresponding mbsync and msmtp commands. Change ~nix/flakevars.nix~ to your liking, and add +new systems if you want. * License -See the [[file:LICENSE.org][license]]. The style.css has its own license. +See the [[file:LICENSE][license]] The style.css has its own license. diff --git a/agenda.org b/agenda.org index fbf3eb6..cf46700 100644 --- a/agenda.org +++ b/agenda.org @@ -53,6 +53,22 @@ I want to make an analogue computer. * Scheduled tasks These are one-time tasks that are scheduled at a particular date, and that don't require regular schedules. +** Appointments +These are tasks related to my appointments which have to be at a specific time. +*** TODO Appointment Call +I have an appointment in a couple days. +SCHEDULED: <2025-09-16 Tue 15:45> +*** TODO Friends Stay a Night +SCHEDULED: <2025-09-23 Tue> +*** TODO Covet Concert +SCHEDULED: <2025-10-10 Fri> +Exciting! +*** TODO Optometry appointment +SCHEDULED: <2025-09-29 Mon 16:45> +For eye health @ Mount Pleasant Optometry. +*** TODO Magbay Concert +SCHEDULED: <2025-09-30 Tue> +Exciting! ** Friends These are tasks related to seeing my friends. There will be tasks listed here when I schedule something. @@ -60,11 +76,17 @@ something. These are some habits I want to track. They are repeated according to a calendar schedule in general. ** TODO Supplements -SCHEDULED: <2025-09-11 Thu .+1d> +SCHEDULED: <2025-09-18 Thu .+1d> :PROPERTIES: -:LAST_REPEAT: [2025-09-10 Wed 03:23] +:LAST_REPEAT: [2025-09-17 Wed 03:40] :STYLE: habit :END: +- State "DONE" from "TODO" [2025-09-17 Wed 03:40] +- State "DONE" from "TODO" [2025-09-16 Tue 03:13] +- State "DONE" from "TODO" [2025-09-14 Sun 18:33] +- State "DONE" from "TODO" [2025-09-14 Sun 02:17] +- State "DONE" from "TODO" [2025-09-12 Fri 23:48] +- State "DONE" from "TODO" [2025-09-12 Fri 23:47] - State "DONE" from "TODO" [2025-09-10 Wed 03:23] - State "DONE" from "TODO" [2025-09-09 Tue 02:39] - State "DONE" from "TODO" [2025-09-08 Mon 15:39] @@ -80,12 +102,15 @@ Current stack: - Iron - Vitamin D3 - EPA/DHA -** TODO Pushups -SCHEDULED: <2025-09-11 Thu .+1d> +- Creatine Monohydrate +** TODO Strength Training +SCHEDULED: <2025-09-18 Thu .+1d> :PROPERTIES: -:LAST_REPEAT: [2025-09-10 Wed 03:23] +:LAST_REPEAT: [2025-09-17 Wed 03:40] :STYLE: habit :END: +- State "DONE" from "TODO" [2025-09-17 Wed 03:40] +- State "DONE" from "TODO" [2025-09-14 Sun 02:26] - State "DONE" from "TODO" [2025-09-10 Wed 03:23] - State "DONE" from "TODO" [2025-09-09 Tue 02:42] - State "DONE" from "TODO" [2025-09-08 Mon 04:35] @@ -103,22 +128,29 @@ SCHEDULED: <2025-08-26 Tue .+1d> - State "DONE" from "TODO" [2025-06-26 Thu 23:22] I want to be able to run or bike every day so that I get my exercise in. ** TODO Stretch -SCHEDULED: <2025-09-10 Wed .+1d> +SCHEDULED: <2025-09-18 Thu .+1d> :PROPERTIES: -:LAST_REPEAT: [2025-09-09 Tue 02:42] +:LAST_REPEAT: [2025-09-17 Wed 03:40] :STYLE: habit :END: +- State "DONE" from "TODO" [2025-09-17 Wed 03:40] +- State "DONE" from "TODO" [2025-09-16 Tue 03:14] +- State "DONE" from "TODO" [2025-09-14 Sun 02:20] - State "DONE" from "TODO" [2025-09-09 Tue 02:42] - State "DONE" from "TODO" [2025-09-08 Mon 04:47] - State "DONE" from "TODO" [2025-02-11 Tue 04:01] - State "DONE" from "TODO" [2025-01-11 Sat 02:26] I want to stretch every day so that I can become more flexible. ** TODO Journal -SCHEDULED: <2025-09-10 Wed .+1d> +SCHEDULED: <2025-09-18 Thu .+1d> :PROPERTIES: -:LAST_REPEAT: [2025-09-09 Tue 02:40] +:LAST_REPEAT: [2025-09-17 Wed 03:40] :STYLE: habit :END: +- State "DONE" from "TODO" [2025-09-17 Wed 03:40] +- State "DONE" from "TODO" [2025-09-16 Tue 03:14] +- State "DONE" from "TODO" [2025-09-14 Sun 02:18] +- State "DONE" from "TODO" [2025-09-12 Fri 23:47] - State "DONE" from "TODO" [2025-09-09 Tue 02:40] - State "DONE" from "TODO" [2025-09-08 Mon 04:35] - State "DONE" from "TODO" [2025-07-20 Sun 21:28] diff --git a/config/elfeed.org b/config/elfeed.org index 5f5db9c..2f85143 100644 --- a/config/elfeed.org +++ b/config/elfeed.org @@ -2,31 +2,18 @@ #+author: Preston Pan #+date: <2023-06-09 Fri> #+description: My list of blogs, news sites, and channels. - #+html_head: * Feed :elfeed: This is the feed I use for Elfeed, and the elfeed-org package allows me to publish them here in an automated fashion. This is why Emacs is so great! -** Blogs :blog: -Here are some interesting blogs, many of which are from substack. -*** [[https://graymirror.substack.com/feed][Gray Mirror]] -Curtis Yarvin is quite the interesting person. -*** [[https://lukesmith.xyz/index.xml][Luke Smith]] :lukesmith: -Luke Smith is quite the interesting person. -*** [[https://terrytao.wordpress.com/feed/][Terence Tao]] -I like math. ** News :news: These are the news articles that I subscribe to. Some of these are politics related but I mostly just want to inform myself about technology subjects. -*** [[https://www.wired.com/feed/tag/ai/latest/rss][Wired AI News]] -Wired isn't too bad at covering science and technology. -*** [[https://www.wired.com/feed/category/science/latest/rss][Wired Science]] -Look above. -*** [[https://feeds.washingtonpost.com/rss/politics?itid=lk_inline_manual_2][Washington Post Politics]] -Politics is almost useless, but it helps with understanding what people are saying around me. *** [[https://news.ycombinator.com/rss][Hacker News]] Hacker News! +*** [[https://www.propublica.org/feeds/propublica/main][Propublica]] +Free news! *** [[https://api.quantamagazine.org/feed/][Quanta Magazine]] Credibility: misreported on ER EPR correspondence ** Podcasts :podcast: @@ -37,10 +24,18 @@ This is a podcast by Luke Smith that talks about anything that he wants to. I like to get new information about recent studies related to technology. *** [[http://www.nature.com/nmat/current_issue/rss/][Nature]] Nature is a prestigious journal with a good bit of good content. +*** NASA :nasa: +This is a list of NASA feeds: +**** [[https://www.nasa.gov/technology/feed/][NASA Tech]] +**** [[https://www.nasa.gov/aeronautics/feed/][NASA Aeronautics]] +**** [[https://www.nasa.gov/missions/station/feed/][NASA Station]] +**** [[https://www.nasa.gov/missions/artemis/feed/][NASA Artemis]] ** YouTube :youtube: These are YouTube channels that I find interesting enough to keep up with. Note that I keep up with a variety of thinkers that I may or may not disagree with, but they are nonetheless the most intellectual version of what their general cohort say: +*** [[https://www.youtube.com/feeds/videos.xml?channel_id=UC1yNl2E66ZzKApQdRuTQ4tw][Sabine Hossenfelder]] +Youtube channel about mostly physics related content (I do not endorse her views on string theory). *** [[https://www.youtube.com/feeds/videos.xml?channel_id=UC7_gcs09iThXybpVgjHZ_7g][PBS Space Time]] PBS space time is a channel that discusses various (sometimes cutting edge) topics in Physics in an expert manner. I find that they are highly accurate, and the host is highly educated in Physics. @@ -71,6 +66,13 @@ Videos about NRx. Linux videos. *** [[https://www.youtube.com/feeds/videos.xml?channel_id=UCU1oodg2ptN51N5rwevwnng][Unlearning Economics]] Videos about economics from a Marxist perspective. -** Misc. -This is a section dedicated to everything that does not fit the above categories -or is newly added from [[file:qutebrowser.org][Qutebrowser]] with the xr keybinding. +** Blogs :blog: +Here are some interesting blogs, many of which are from substack. +*** [[https://terrytao.wordpress.com/feed/][Terence Tao]] +I like math. +*** [[https://graymirror.substack.com/feed][Gray Mirror]] +Curtis Yarvin is quite the interesting person. +*** [[https://www.richardhanania.com/feed][Richard Hanania]] +Richard is a political commentator. +*** [[https://lukesmith.xyz/index.xml][Luke Smith]] :lukesmith: +Luke Smith is quite the interesting person. diff --git a/config/emacs.el b/config/emacs.el index 7aa4517..8cffb3d 100644 --- a/config/emacs.el +++ b/config/emacs.el @@ -1,7 +1,3 @@ -(setq system-email "ret2pop@gmail.com") -(setq system-username "ret2pop") -(setq system-fullname "Preston Pan") - (use-package emacs :custom ;; global defaults @@ -99,7 +95,6 @@ ;; load theme, fonts, and transparency. Prettify symbols. (global-prettify-symbols-mode 1) - (load-theme 'catppuccin :no-confirm) (set-face-attribute 'default nil :font "Iosevka Nerd Font" :height 130) (set-frame-parameter nil 'alpha-background 90) (add-to-list 'default-frame-alist '(alpha-background . 90))) @@ -136,39 +131,31 @@ (org-agenda-files (list "~/monorepo/agenda.org" "~/org/notes.org" "~/org/agenda.org") "set default org files") (org-default-notes-file (concat org-directory "/notes.org") "Notes file") (org-publish-project-alist - '(("website-org" - :base-directory "~/monorepo" - :base-extension "org" - :publishing-directory "~/website_html" - :recursive t - :publishing-function org-html-publish-to-html - :headline-levels 4 - :html-preamble t - :html-preamble-format (("en" "

home | section main page


"))) - ("website-static" - :base-directory "~/monorepo" - :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|ico\\|asc\\|pub\\|webmanifest\\|xml\\|svg" - :publishing-directory "~/website_html/" - :recursive t - :publishing-function org-publish-attachment) - ("website" :auto-sitemap t :components ("website-org" "website-static"))) "functions to publish website") - (org-html-postamble "Copyright © 2024 Preston Pan" "set copyright notice on bottom of site") + '(("website-org" + :base-directory "~/monorepo" + :base-extension "org" + :publishing-directory "~/website_html" + :recursive t + :publishing-function org-html-publish-to-html + :headline-levels 4 + :html-preamble t + :html-preamble-format (("en" "

home | section main page


"))) + ("website-static" + :base-directory "~/monorepo" + :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|ico\\|asc\\|pub\\|webmanifest\\|xml\\|svg" + :publishing-directory "~/website_html/" + :recursive t + :publishing-function org-publish-attachment) + ("website" :auto-sitemap t :components ("website-org" "website-static"))) "functions to publish website") + (org-html-postamble (concat "Copyright © 2024 " system-fullname) "set copyright notice on bottom of site") :config (require 'ox-publish) (require 'org-tempo) (require 'org-habit) (org-babel-do-load-languages 'org-babel-load-languages - '((shell . t) - (python . t) - (latex . t)))) - -;; (with-eval-after-load 'org -;; ;; stop electric-pair from pairing < in org-mode -;; (add-hook 'org-mode-hook -;; (lambda () -;; (setq-local electric-pair-inhibit-predicate -;; (lambda (c) -;; (if (eq c ?<) t (electric-pair-default-inhibit c))))))) + '((shell . t) + (python . t) + (latex . t)))) (use-package unicode-fonts :init (unicode-fonts-setup)) @@ -180,13 +167,6 @@ (use-package wgrep :after grep) -(use-package lyrics-fetcher - :after (emms) - :custom - (lyrics-fetcher-genius-access-token (password-store-get "genius_api") "Use genius for backend") - :config - (lyrics-fetcher-use-backend 'genius)) - (defun insert-urandom-password (&optional length) (interactive "P") (let ((length (or length 32)) @@ -286,6 +266,19 @@ :config (doom-modeline-mode 1)) +(use-package doom-themes + :ensure t + :custom + (doom-themes-enable-bold t) + (doom-themes-enable-italic t) + (doom-themes-treemacs-theme "doom-rouge") + :config + (load-theme 'doom-rouge t) + + (doom-themes-visual-bell-config) + (doom-themes-treemacs-config) + (doom-themes-org-config)) + (use-package writegood-mode :hook (text-mode . writegood-mode)) @@ -387,8 +380,8 @@ (use-package erc :custom - (erc-nick system-username "Set erc nick to username") - (erc-user-full-name system-fullname "Use real name for full name")) + (erc-nick system-username "sets erc username to the one set in nix config") + (erc-user-full-name system-fullname "sets erc fullname to the one set in nix config")) (use-package general :init @@ -481,7 +474,6 @@ "h i" '(info :wk "Info") "s i p" '(insert-urandom-password :wk "insert random password to buffer (for sops)") - "u w" '((lambda () (interactive) (shell-command "rsync -azvP ~/website_html/ root@nullring.xyz:/usr/share/nginx/ret2pop/")) :wk "rsync website update") "h r r" '(lambda () (interactive) (org-babel-load-file (expand-file-name "~/monorepo/config/emacs.org"))))) @@ -623,7 +615,7 @@ (message-kill-buffer-on-exit t "Kill buffer when I exit mu4e") (mu4e-compose-dont-reply-to-self t "Don't include self in replies") (mu4e-change-filenames-when-moving t) - (mu4e-get-mail-command "mbsync ret2pop" "Use mbsync for imap") + (mu4e-get-mail-command (concat "mbsync " system-username) "Use mbsync for imap") (mu4e-compose-reply-ignore-address (list "no-?reply" system-email) "ignore my own address and noreply") (mu4e-html2text-command "w3m -T text/html" "Use w3m to convert html to text") (mu4e-update-interval 300 "Update duration") diff --git a/config/emacs.org b/config/emacs.org index c4bb4d9..7cb2abd 100644 --- a/config/emacs.org +++ b/config/emacs.org @@ -7,13 +7,6 @@ This is my Vanilla Emacs configuration, made to work with my NixOS configuration reason, you will not see :ensure t inside any use-package declaration, for emacs packages are all compiled natively and reproducibly on the NixOS side. This configuration uses the emacs-lisp language only to configure variables for said packages, for the most part. -** User -Change these variables: -#+begin_src emacs-lisp -(setq system-email "ret2pop@gmail.com") -(setq system-username "ret2pop") -(setq system-fullname "Preston Pan") -#+end_src ** Emacs These are all the options that need to be set at the start of the program. Because use-package is largely declarative, the order of many of these options should not matter. However, there @@ -119,7 +112,6 @@ Emacs is self documenting, after all! ;; load theme, fonts, and transparency. Prettify symbols. (global-prettify-symbols-mode 1) - (load-theme 'catppuccin :no-confirm) (set-face-attribute 'default nil :font "Iosevka Nerd Font" :height 130) (set-frame-parameter nil 'alpha-background 90) (add-to-list 'default-frame-alist '(alpha-background . 90))) @@ -169,39 +161,31 @@ This is my org mode configuration, which also configures latex. (org-agenda-files (list "~/monorepo/agenda.org" "~/org/notes.org" "~/org/agenda.org") "set default org files") (org-default-notes-file (concat org-directory "/notes.org") "Notes file") (org-publish-project-alist - '(("website-org" - :base-directory "~/monorepo" - :base-extension "org" - :publishing-directory "~/website_html" - :recursive t - :publishing-function org-html-publish-to-html - :headline-levels 4 - :html-preamble t - :html-preamble-format (("en" "

home | section main page


"))) - ("website-static" - :base-directory "~/monorepo" - :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|ico\\|asc\\|pub\\|webmanifest\\|xml\\|svg" - :publishing-directory "~/website_html/" - :recursive t - :publishing-function org-publish-attachment) - ("website" :auto-sitemap t :components ("website-org" "website-static"))) "functions to publish website") - (org-html-postamble "Copyright © 2024 Preston Pan" "set copyright notice on bottom of site") + '(("website-org" + :base-directory "~/monorepo" + :base-extension "org" + :publishing-directory "~/website_html" + :recursive t + :publishing-function org-html-publish-to-html + :headline-levels 4 + :html-preamble t + :html-preamble-format (("en" "

home | section main page


"))) + ("website-static" + :base-directory "~/monorepo" + :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|ico\\|asc\\|pub\\|webmanifest\\|xml\\|svg" + :publishing-directory "~/website_html/" + :recursive t + :publishing-function org-publish-attachment) + ("website" :auto-sitemap t :components ("website-org" "website-static"))) "functions to publish website") + (org-html-postamble (concat "Copyright © 2024 " system-fullname) "set copyright notice on bottom of site") :config (require 'ox-publish) (require 'org-tempo) (require 'org-habit) (org-babel-do-load-languages 'org-babel-load-languages - '((shell . t) - (python . t) - (latex . t)))) - - ;; (with-eval-after-load 'org - ;; ;; stop electric-pair from pairing < in org-mode - ;; (add-hook 'org-mode-hook - ;; (lambda () - ;; (setq-local electric-pair-inhibit-predicate - ;; (lambda (c) - ;; (if (eq c ?<) t (electric-pair-default-inhibit c))))))) + '((shell . t) + (python . t) + (latex . t)))) #+end_src As you can see, I only have one real entry in config here (I don't count requires even though they have to be on the top) @@ -220,20 +204,11 @@ what electric-pair does based on the mode. (org-mode . (lambda () (setq-local electric-pair-inhibit-predicate (lambda (c) (if (eq c ?<) t (electric-pair-default-inhibit c)))))))) #+end_src * Search and Replace +wgrep is a program that allows you to do more intelligent search and replace. #+begin_src emacs-lisp (use-package wgrep :after grep) #+end_src -* Lyrics -This currently doesn't work I'm pretty sure, but it's supposed to fetch lyrics from mpd. -#+begin_src emacs-lisp - (use-package lyrics-fetcher - :after (emms) - :custom - (lyrics-fetcher-genius-access-token (password-store-get "genius_api") "Use genius for backend") - :config - (lyrics-fetcher-use-backend 'genius)) -#+end_src * Passwords This is a function that inserts a random password into the buffer. I use this to manage sops-nix. #+begin_src emacs-lisp @@ -359,6 +334,23 @@ The default modeline is ugly. I replace it with the doom modeline because it's b :config (doom-modeline-mode 1)) #+end_src +*** Doom Theme +I used to use catppuccin, but the doom themes are so good that I am willing to break some theme consistency with my desktop in order +to use doom themes. I mean it looks better anyways if emacs is a distinct theme. +#+begin_src emacs-lisp + (use-package doom-themes + :ensure t + :custom + (doom-themes-enable-bold t) + (doom-themes-enable-italic t) + (doom-themes-treemacs-theme "doom-rouge") + :config + (load-theme 'doom-rouge t) + + (doom-themes-visual-bell-config) + (doom-themes-treemacs-config) + (doom-themes-org-config)) +#+end_src ** Grammar I want to write good! I grammar good too. #+begin_src emacs-lisp @@ -491,8 +483,8 @@ Configure IRC to use my username. #+begin_src emacs-lisp (use-package erc :custom - (erc-nick system-username "Set erc nick to username") - (erc-user-full-name system-fullname "Use real name for full name")) + (erc-nick system-username "sets erc username to the one set in nix config") + (erc-user-full-name system-fullname "sets erc fullname to the one set in nix config")) #+end_src ** Keybindings Global keybindings for everything that I care about globally. It's all here! I use general @@ -590,7 +582,6 @@ emacs keybindings. "h i" '(info :wk "Info") "s i p" '(insert-urandom-password :wk "insert random password to buffer (for sops)") - "u w" '((lambda () (interactive) (shell-command "rsync -azvP ~/website_html/ root@nullring.xyz:/usr/share/nginx/ret2pop/")) :wk "rsync website update") "h r r" '(lambda () (interactive) (org-babel-load-file (expand-file-name "~/monorepo/config/emacs.org"))))) #+end_src @@ -766,7 +757,7 @@ Email in emacs can be done with Mu4e. (message-kill-buffer-on-exit t "Kill buffer when I exit mu4e") (mu4e-compose-dont-reply-to-self t "Don't include self in replies") (mu4e-change-filenames-when-moving t) - (mu4e-get-mail-command "mbsync ret2pop" "Use mbsync for imap") + (mu4e-get-mail-command (concat "mbsync " system-username) "Use mbsync for imap") (mu4e-compose-reply-ignore-address (list "no-?reply" system-email) "ignore my own address and noreply") (mu4e-html2text-command "w3m -T text/html" "Use w3m to convert html to text") (mu4e-update-interval 300 "Update duration") @@ -801,4 +792,4 @@ For some reason, lean4-mode is not in MELPA currently so I have to do this ugly :rev "76895d8939111654a472cfc617cfd43fbf5f1eb6")) #+end_src and actually pull something from the internet instead of pinning. Thankfully this reproduction issue is probably localized to lean files. Also, -we're pulling a specific commit so it is still pinned. +we're pulling a specific commit so it is still pinned. If it fails to fetch, lean4 is broken I guess. diff --git a/config/nix.org b/config/nix.org index 117ad20..a0bf8b8 100644 --- a/config/nix.org +++ b/config/nix.org @@ -13,10 +13,40 @@ emacs configuration is pinned to my flake. Hence, my monorepo serves a dual purpose, as do many of the files within my monorepo. They are often data files used in my configuration (i.e. emacs, elfeed, org-roam, agenda, journal, etc...) and they are webpages as well. This page is one such example of this concept. + +* Configurables +We start with some configurable variables (you can change these if you want to use this configuration yourself): +#+begin_src nix :tangle ../nix/flakevars.nix + let + # I'm ret2pop! What's your name? + internetName = "ret2pop"; + in + { + # Name of spontaneity box + remoteHost = "${internetName}.net"; + + # Your internet name + internetName = internetName; + + # Name of your organization + orgHost = "nullring.xyz"; + + # Hostnames of my systems + hostnames = [ + "affinity" + "continuity" + "spontaneity" + "installer" + ]; + } +#+end_src + * Flake.nix The flake is the entry point of the NixOS configuration. Here, I have a list of all the systems that I use with all the modules that they use. My NixOS configuration is heavily modularized, so that adding new configurations that add modifications is made simple. + +and now for the main flake: #+begin_src nix :tangle ../nix/flake.nix { description = "Emacs centric configurations for a complete networked system"; @@ -25,48 +55,58 @@ so that adding new configurations that add modifications is made simple. nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nur.url = "github:nix-community/NUR"; sops-nix.url = "github:Mic92/sops-nix"; + scripts.url = "github:ret2pop/scripts"; wallpapers.url = "github:ret2pop/wallpapers"; sounds.url = "github:ret2pop/sounds"; + deep-research.url = "github:ret2pop/ollama-deep-researcher"; + impermanence.url = "github:nix-community/impermanence"; + nix-topology = { url = "github:oddlama/nix-topology"; inputs.nixpkgs.follows = "nixpkgs"; }; - deep-research = { - url = "github:ret2pop/ollama-deep-researcher"; - }; + home-manager = { url = "github:nix-community/home-manager/release-25.05"; inputs.nixpkgs.follows = "nixpkgs"; }; + disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; }; + lanzaboote = { url = "github:nix-community/lanzaboote/v0.4.1"; inputs.nixpkgs.follows = "nixpkgs"; }; + nixos-dns = { url = "github:Janik-Haag/nixos-dns"; inputs.nixpkgs.follows = "nixpkgs"; }; }; - outputs = { self, nixpkgs, home-manager, nur, disko, lanzaboote, sops-nix, nix-topology, nixos-dns, deep-research, ... }@attrs: + outputs = { + self, + nixpkgs, + home-manager, + nur, + disko, + lanzaboote, + sops-nix, + nix-topology, + nixos-dns, + deep-research, + impermanence, + ... + } + @attrs: let - hostnames = [ - "affinity" - "continuity" - "installer" - "spontaneity" - # add hostnames here - ]; - + vars = import ./flakevars.nix; system = "x86_64-linux"; - pkgs = import nixpkgs { inherit system; }; - generate = nixos-dns.utils.generate nixpkgs.legacyPackages."${system}"; dnsConfig = { @@ -76,93 +116,94 @@ so that adding new configurations that add modifications is made simple. # function that generates all systems from hostnames mkConfigs = map (hostname: {name = "${hostname}"; - value = nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = attrs; - modules = if (hostname == "installer") then [ - (./. + "/systems/${hostname}/default.nix") - { networking.hostName = "${hostname}"; } - nix-topology.nixosModules.default - ] else [ - { - environment.systemPackages = with nixpkgs.lib; [ - deep-research.packages."${system}".deep-research - ]; - } - nix-topology.nixosModules.default - lanzaboote.nixosModules.lanzaboote - disko.nixosModules.disko - home-manager.nixosModules.home-manager - sops-nix.nixosModules.sops - nixos-dns.nixosModules.dns - { - nixpkgs.overlays = [ nur.overlays.default ]; - home-manager.extraSpecialArgs = attrs // { systemHostName = "${hostname}"; }; - networking.hostName = "${hostname}"; - } - (./. + "/systems/${hostname}/default.nix") - ]; - }; - }); + value = nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = attrs; + modules = if (hostname == "installer") then [ + (./. + "/systems/${hostname}/default.nix") + { networking.hostName = "${hostname}"; } + nix-topology.nixosModules.default + ] else [ + { + environment.systemPackages = with nixpkgs.lib; [ + deep-research.packages."${system}".deep-research + ]; + } + impermanence.nixosModules.impermanence + nix-topology.nixosModules.default + lanzaboote.nixosModules.lanzaboote + disko.nixosModules.disko + home-manager.nixosModules.home-manager + sops-nix.nixosModules.sops + nixos-dns.nixosModules.dns + { + nixpkgs.overlays = [ nur.overlays.default ]; + home-manager.extraSpecialArgs = attrs // { systemHostName = "${hostname}"; }; + networking.hostName = "${hostname}"; + } + (./. + "/systems/${hostname}/default.nix") + ]; + }; + }); mkDiskoFiles = map (hostname: { name = "${hostname}"; value = self.nixosConfigurations."${hostname}".config.monorepo.vars.diskoSpec; }); + in + { + nixosConfigurations = builtins.listToAttrs (mkConfigs vars.hostnames); - in { - nixosConfigurations = builtins.listToAttrs (mkConfigs hostnames); - - evalDisko = builtins.listToAttrs (mkDiskoFiles (builtins.filter (x: x != "installer") hostnames)); + evalDisko = builtins.listToAttrs (mkDiskoFiles (builtins.filter (x: x != "installer") vars.hostnames)); - topology."${system}" = import nix-topology { - pkgs = import nixpkgs { - inherit system; - overlays = [ nix-topology.overlays.default ]; + topology."${system}" = import nix-topology { + pkgs = import nixpkgs { + inherit system; + overlays = [ nix-topology.overlays.default ]; + }; + modules = [ + ./topology/default.nix + { nixosConfigurations = self.nixosConfigurations; } + ]; }; - modules = [ - ./topology/default.nix - { nixosConfigurations = self.nixosConfigurations; } - ]; - }; - devShell."${system}" = with pkgs; mkShell { - buildInputs = [ - fira-code - python3 - poetry - statix - deadnix - ]; - }; + devShell."${system}" = with pkgs; mkShell { + buildInputs = [ + fira-code + python3 + poetry + statix + deadnix + ]; + }; - packages."${system}" = { - zoneFiles = generate.zoneFiles dnsConfig; - octodns = generate.octodnsConfig { - inherit dnsConfig; - - config = { - providers = { - cloudflare = { - class = "octodns_cloudflare.CloudflareProvider"; - token = "env/CLOUDFLARE_TOKEN"; - }; - config = { - check_origin = false; + packages."${system}" = { + zoneFiles = generate.zoneFiles dnsConfig; + octodns = generate.octodnsConfig { + inherit dnsConfig; + + config = { + providers = { + cloudflare = { + class = "octodns_cloudflare.CloudflareProvider"; + token = "env/CLOUDFLARE_TOKEN"; + }; + config = { + check_origin = false; + }; }; }; - }; - zones = { - "ret2pop.net." = nixos-dns.utils.octodns.generateZoneAttrs [ "cloudflare" ]; - "nullring.xyz." = nixos-dns.utils.octodns.generateZoneAttrs [ "cloudflare" ]; + zones = { + "${vars.remoteHost}." = nixos-dns.utils.octodns.generateZoneAttrs [ "cloudflare" ]; + "${vars.orgHost}." = nixos-dns.utils.octodns.generateZoneAttrs [ "cloudflare" ]; + }; }; }; }; - }; } #+end_src -Note that the configurations are automatically generated with he -mkConfigs function. +Note that the configurations are automatically generated with he mkConfigs function, and the final disko output is automatically generated +with mkDiskoFiles. * Sops Configuration In order to use the sops configuration, you must change the age public key to the one that you own: @@ -249,6 +290,9 @@ Variables used for regular configuration in your system ~default.nix~ file. The largely self-documenting. #+begin_src nix :tangle ../nix/modules/vars.nix { lib, ... }: + let + vars = import ../flakevars.nix; + in { options.monorepo.vars = { device = lib.mkOption { @@ -258,6 +302,20 @@ largely self-documenting. description = "device that NixOS is installed to"; }; + internetName = lib.mkOption { + type = lib.types.str; + default = "${vars.internetName}"; + example = "myinternetname"; + description = "Internet name to be used for internet usernames"; + }; + + repoName = lib.mkOption { + type = lib.types.str; + default = "monorepo"; + example = "myreponame"; + description = "Name of this repository"; + }; + fileSystem = lib.mkOption { type = lib.types.str; default = "ext4"; @@ -293,11 +351,18 @@ largely self-documenting. remoteHost = lib.mkOption { type = lib.types.str; - default = "ret2pop.net"; + default = "${vars.remoteHost}"; example = "example.com"; description = "Address to push to and pull from for website and git repos"; }; + orgHost = lib.mkOption { + type = lib.types.str; + default = "${vars.orgHost}"; + example = "orgname.org"; + description = "Domain name of your organization"; + }; + timeZone = lib.mkOption { type = lib.types.str; default = "America/Vancouver"; @@ -345,19 +410,27 @@ under ~default.nix~ in the ~systems~ folder. ttyonly.enable = lib.mkEnableOption "TTY only, no xserver"; grub.enable = lib.mkEnableOption "Enables grub instead of systemd-boot"; workstation.enable = lib.mkEnableOption "Enables workstation services"; + impermanence.enable = lib.mkEnableOption "Enables imperamanence"; }; }; }; config = { - environment.systemPackages = lib.mkIf config.monorepo.profiles.documentation.enable (with pkgs; [ + environment.systemPackages = lib.mkIf config.monorepo.profiles.documentation.enable ((with pkgs; [ linux-manual man-pages man-pages-posix iproute2 silver-searcher ripgrep - ]); + ]) ++ + (if (config.monorepo.vars.fileSystem == "btrfs") then with pkgs; [ + btrfs-progs + btrfs-snap + btrfs-list + btrfs-heatmap + ] else [])); + boot.loader.grub = lib.mkIf config.monorepo.profiles.grub.enable { enable = true; }; @@ -368,6 +441,7 @@ under ~default.nix~ in the ~systems~ folder. pipewire.enable = lib.mkDefault true; tor.enable = lib.mkDefault true; home.enable = lib.mkDefault true; + impermanence.enable = lib.mkDefault false; }; }; }; @@ -528,9 +602,9 @@ distribution soon, and I'm waiting on that. hostName = "0.0.0.0"; welcometext = "Wecome to the Null Murmur instance!"; registerName = "nullring"; - registerHostname = "nullring.xyz"; - sslCert = "/var/lib/acme/nullring.xyz/fullchain.pem"; - sslKey = "/var/lib/acme/nullring.xyz/sslKey.pem"; + registerHostname = "${config.monorepo.vars.orgHost}"; + sslCert = "/var/lib/acme/${config.monorepo.vars.orgHost}/fullchain.pem"; + sslKey = "/var/lib/acme/${config.monorepo.vars.orgHost}/sslKey.pem"; }; } #+end_src @@ -586,7 +660,7 @@ I run my own IRC server to bridge with my Matrix server and my discord guild. enable = lib.mkDefault config.monorepo.profiles.server.enable; config = '' [Global] - Name = nullring.xyz + Name = ${config.monorepo.vars.orgHost} Info = NullRing IRC Instance Listen = 0.0.0.0 MotdFile = /etc/motd.txt @@ -595,9 +669,9 @@ I run my own IRC server to bridge with my Matrix server and my discord guild. [Options] PAM = no [SSL] - CertFile = /var/lib/acme/nullring.xyz/fullchain.pem + CertFile = /var/lib/acme/${config.monorepo.vars.orgHost}/fullchain.pem CipherList = HIGH:!aNULL:@STRENGTH:!SSLv3 - KeyFile = /var/lib/acme/nullring.xyz/key.pem + KeyFile = /var/lib/acme/${config.monorepo.vars.orgHost}/key.pem Ports = 6697 ''; }; @@ -669,10 +743,11 @@ still federating and hosting the same protocol. services.matrix-conduit = { enable = lib.mkDefault config.monorepo.profiles.server.enable; settings.global = { - server_name = "matrix.${config.monorepo.vars.remoteHost}"; + server_name = "matrix.${config.monorepo.vars.orgHost}"; trusted_servers = [ "matrix.org" "nixos.org" + "conduit.rs" ]; address = "0.0.0.0"; port = 6167; @@ -681,8 +756,20 @@ still federating and hosting the same protocol. }; } #+end_src +** Honk +In order to connect to activitypub: +#+begin_src nix :tangle ../nix/modules/honk.nix + { lib, config, ... }: + { + services.honk = { + enable = config.monorepo.vars.ttyonly; + servername = "ret2pop.net"; + username = "ret2pop"; + }; + } +#+end_src ** Matterbridge -Then I want to connect all these servers together with Matterbridge: +I want to connect IRC to discord with matterbridge. #+begin_src nix :tangle ../nix/modules/matterbridge.nix { lib, config, ... }: { @@ -692,20 +779,178 @@ Then I want to connect all these servers together with Matterbridge: }; } #+end_src +*** Mautrix +I use this bridge to bridge myself from Matrix to Discord and vise versa, because Matterbridge is not maintained very well and therefore +does not support conduit at the moment. Note that this is not fully declarative and requires that you add +~/var/lib/mautrix-discord/discord-registration.yaml~ as an appservice to conduit. +#+begin_src nix :tangle ../nix/modules/mautrix.nix + { lib, config, ... }: + { + services.mautrix-discord = { + enable = lib.mkDefault config.monorepo.profiles.server.enable; + environmentFile = "/etc/mautrix"; + settings = { + bridge = { + animated_sticker = { + args = { + fps = 25; + height = 320; + width = 320; + }; + target = "webp"; + }; + autojoin_thread_on_open = true; + avatar_proxy_key = "generate"; + backfill = { + forward_limits = { + initial = { + channel = 0; + dm = 0; + thread = 0; + }; + max_guild_members = -1; + missed = { + channel = 0; + dm = 0; + thread = 0; + }; + }; + }; + cache_media = "unencrypted"; + channel_name_template = "{{if or (eq .Type 3) (eq .Type 4)}}{{.Name}}{{else}}#{{.Name}}{{end}}"; + command_prefix = "!discord"; + custom_emoji_reactions = true; + delete_guild_on_leave = true; + delete_portal_on_channel_delete = false; + delivery_receipts = false; + direct_media = { + allow_proxy = true; + enabled = false; + server_key = "generate"; + }; + displayname_template = "{{if .Webhook}}Webhook{{else}}{{or .GlobalName .Username}}{{if .Bot}} (bot){{end}}{{end}}"; + double_puppet_allow_discovery = true; + double_puppet_server_map = { }; + embed_fields_as_tables = true; + enable_webhook_avatars = true; + encryption = { + allow = false; + allow_key_sharing = false; + appservice = false; + default = false; + delete_keys = { + delete_fully_used_on_decrypt = false; + delete_on_device_delete = false; + delete_outbound_on_ack = false; + delete_outdated_inbound = false; + delete_prev_on_new_session = false; + dont_store_outbound = false; + periodically_delete_expired = false; + ratchet_on_decrypt = false; + }; + msc4190 = false; + plaintext_mentions = false; + require = false; + rotation = { + disable_device_change_key_rotation = false; + enable_custom = false; + messages = 100; + milliseconds = 604800000; + }; + verification_levels = { + receive = "unverified"; + send = "unverified"; + share = "cross-signed-tofu"; + }; + }; + federate_rooms = true; + guild_name_template = "{{.Name}}"; + login_shared_secret_map = { }; + management_room_text = { + additional_help = ""; + welcome = "Hello, I'm a Discord bridge bot."; + welcome_connected = "Use `help` for help."; + welcome_unconnected = "Use `help` for help or `login` to log in."; + }; + message_error_notices = true; + message_status_events = false; + mute_channels_on_create = false; + permissions = { + "@${config.monorepo.vars.internetName}:matrix.${config.monorepo.vars.orgHost}" = "admin"; + "*" = "user"; + }; + portal_message_buffer = 128; + prefix_webhook_messages = true; + private_chat_portal_meta = "default"; + provisioning = { + debug_endpoints = false; + prefix = "/_matrix/provision"; + shared_secret = "generate"; + }; + public_address = null; + resend_bridge_info = false; + restricted_rooms = false; + startup_private_channel_create_limit = 5; + sync_direct_chat_list = false; + use_discord_cdn_upload = true; + username_template = "discord_{{.}}"; + }; + + appservice = { + address = "http://localhost:29334"; + hostname = "0.0.0.0"; + port = 29334; + id = "discord"; + bot = { + username = "discordbot"; + displayname = "Discord bridge bot"; + avatar = "mxc://maunium.net/nIdEykemnwdisvHbpxflpDlC"; + }; + ephemeral_events = true; + async_transactions = false; + database = { + type = "sqlite3"; + uri = "file:${config.services.mautrix-discord.dataDir}/mautrix-discord.db?_txlock=immediate"; + max_open_conns = 20; + max_idle_conns = 2; + max_conn_idle_time = null; + max_conn_lifetime = null; + }; + as_token = "$MAUTRIX_DISCORD_APPSERVICE_AS_TOKEN"; + hs_token = "$MAUTRIX_DISCORD_APPSERVICE_HS_TOKEN"; + }; + + dataDir = "/var/lib/mautrix-discord"; + homeserver = { + async_media = false; + message_send_checkpoint_endpoint = null; + ping_interval_seconds = 0; + software = "standard"; + status_endpoint = null; + websocket = false; + domain = "matrix.${config.monorepo.vars.orgHost}"; + address = "http://localhost:6167"; + }; + }; + }; + } +#+end_src ** Ollama Use ollama for serving large language models to my other computers. #+begin_src nix :tangle ../nix/modules/ollama.nix { config, lib, ... }: { services.ollama = { - enable = lib.mkDefault (!config.monorepo.profiles.ttyonly.enable); + enable = lib.mkDefault (!config.monorepo.profiles.server.enable); acceleration = if (config.monorepo.profiles.workstation.enable) then "cuda" else null; - loadModels = [ + loadModels = if (config.monorepo.profiles.workstation.enable) then [ "qwen3:30b" "qwen3-coder:latest" "qwen2.5-coder:latest" - "qwen2.5-coder:3b" "gemma3:12b-it-qat" + ] else [ + "qwen3:0.6b" + "qwen2.5-coder:0.5b" ]; host = "0.0.0.0"; openFirewall = true; @@ -757,7 +1002,7 @@ to the outside world under a domain. }; virtualHosts = { - "matrix.${config.monorepo.vars.remoteHost}" = { + "matrix.${config.monorepo.vars.orgHost}" = { enableACME = true; forceSSL = true; listen = [ @@ -796,14 +1041,14 @@ to the outside world under a domain. }; "${config.monorepo.vars.remoteHost}" = { serverName = "${config.monorepo.vars.remoteHost}"; - serverAliases = [ "ret2pop.nullring.xyz" ]; - root = "/var/www/ret2pop-website/"; + serverAliases = [ "${config.monorepo.vars.internetName}.${config.monorepo.vars.orgHost}" ]; + root = "/var/www/${config.monorepo.vars.internetName}-website/"; addSSL = true; enableACME = true; }; - "nullring.xyz" = { - serverName = "nullring.xyz"; + "${config.monorepo.vars.orgHost}" = { + serverName = "${config.monorepo.vars.orgHost}"; root = "/var/www/nullring/"; addSSL = true; enableACME = true; @@ -832,6 +1077,7 @@ world. This was the easiest frontend to set up on NixOS. } #+end_src ** Nvidia +I have an Nvidia GPU on my computer. #+begin_src nix :tangle ../nix/modules/nvidia.nix { config, lib, pkgs, ... }: { @@ -857,6 +1103,7 @@ world. This was the easiest frontend to set up on NixOS. } #+end_src ** CUDA +I need CUDA on some computers because I run local LLMs. #+begin_src nix :tangle ../nix/modules/cuda.nix { config, lib, pkgs, ... }: { @@ -888,13 +1135,102 @@ world. This was the easiest frontend to set up on NixOS. "submission tls://0.0.0.0:465 tcp://0.0.0.0:587" ] options.services.maddy.config.default; ensureCredentials = { - "preston@localhost" = { - passwordFile = "/secrets/preston-localhost"; + "${config.monorepo.vars.userName}@localhost" = { + passwordFile = "/secrets/${config.monorepo.vars.userName}-localhost"; }; }; }; } #+end_src +** Impermanence +This is my impermanence profile, which removes all files on reboot except for the ones listed below. +#+begin_src nix :tangle ../nix/modules/impermanence.nix + { lib, config, ... }: + { + assertions = [ + { + assertion = ! (config.monorepo.profiles.impermanence.enable && (! (config.monorepo.vars.filesystem == "btrfs"))); + message = "Impermanence requires btrfs filesystem."; + } + ]; + + boot.initrd.postResumeCommands = (if config.monorepo.profiles.impermanence.enable then lib.mkAfter '' + mkdir /btrfs_tmp + mount /dev/root_vg/root /btrfs_tmp + if [[ -e /btrfs_tmp/root ]]; then + mkdir -p /btrfs_tmp/old_roots + timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S") + mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp" + fi + + delete_subvolume_recursively() { + IFS=$'\n' + for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do + delete_subvolume_recursively "/btrfs_tmp/$i" + done + btrfs subvolume delete "$1" + } + + for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do + delete_subvolume_recursively "$i" + done + + btrfs subvolume create /btrfs_tmp/root + umount /btrfs_tmp + '' else ""); + + environment.persistence."/persistent" = { + enable = config.monorepo.profiles.impermanence.enable; + hideMounts = true; + directories = [ + "/var/log" + "/var/lib/bluetooth" + "/var/lib/nixos" + "/var/lib/systemd/coredump" + "/etc/NetworkManager/system-connections" + ]; + files = [ + "/etc/machine-id" + "/etc/matterbridge.toml" + { file = "/var/keys/secret_file"; parentDirectory = { mode = "u=rwx,g=,o="; }; } + ]; + users."${config.monorepo.vars.userName}" = { + directories = [ + "Downloads" + "music" + "Pictures" + "Documents" + "Videos" + "Monero" + "org" + "monorepo" + "soundfont" + "website_html" + "ardour" + "audacity" + "img" + "email" + "projects" + "secrets" + + ".emacs.d" + ".elfeed" + ".electrum" + ".mozilla" + ".bitmonero" + ".config" + { directory = ".gnupg"; mode = "0700"; } + { directory = ".ssh"; mode = "0700"; } + { directory = ".local/share/keyrings"; mode = "0700"; } + ".local/share/direnv" + ]; + files = [ + ".emacs" + ]; + }; + }; + } +#+end_src ** Main Configuration This is the backbone of the all the NixOS configurations, with all these options being shared because they enhance security. @@ -903,6 +1239,7 @@ because they enhance security. { imports = [ ./matterbridge.nix + ./mautrix.nix ./xserver.nix ./ssh.nix ./pipewire.nix @@ -921,6 +1258,7 @@ because they enhance security. ./ngircd.nix ./znc.nix ./docker.nix + ./impermanence.nix ]; documentation = { @@ -1063,7 +1401,7 @@ because they enhance security. "kernel.kptr_restrict" = 2; # madaidan - "kernel.smtcontrol" = "on"; + "kernel.smtcontrol" = "on"; "vm.swappiness" = 1; "vm.unprivileged_userfaultfd" = 0; "dev.tty.ldisc_autoload" = 0; @@ -1296,37 +1634,68 @@ with configurable disk. { lib, config, ... }: let spec = { - disko.devices = { - disk = { - main = { - type = "disk"; - device = config.monorepo.vars.device; - content = { - type = "gpt"; - partitions = { - ESP = { - priority = 1; - name = "ESP"; - start = "1M"; - end = "128M"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - mountOptions = [ "umask=0077" ]; + disko.devices = { + disk = { + main = { + type = "disk"; + device = config.monorepo.vars.device; + content = { + type = "gpt"; + partitions = { + ESP = { + size = "512M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = [ "umask=0077" ]; + }; }; - }; - root = { - size = "100%"; - content = { - type = "btrfs"; - extraArgs = [ "-f" ]; # Override existing partition - mountpoint = "/"; - mountOptions = [ - "compress=zstd" - "noatime" - ]; + luks = { + size = "100%"; + content = { + type = "luks"; + name = "crypted"; + passwordFile = "/tmp/secret.key"; + content = { + type = "btrfs"; + extraArgs = [ "-f" ]; + subvolumes = { + "/root" = { + mountpoint = "/"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + + "/home" = { + mountpoint = "/home"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + + "/nix" = { + mountpoint = "/nix"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + + "/persistent" = { + mountpoint = "/persistent"; + mountOptions = [ + "compress=zstd" + "noatime" + ]; + }; + }; + }; + }; }; }; }; @@ -1334,7 +1703,6 @@ with configurable disk. }; }; }; - }; in { monorepo.vars.diskoSpec = spec; @@ -1469,6 +1837,8 @@ I have many imports that we'll go through next. lang-openscad.enable = lib.mkEnableOption "Enables openscad language support"; lang-js.enable = lib.mkEnableOption "Enables javascript language support"; lang-nix.enable = lib.mkEnableOption "Enables nix language support"; + lang-idris.enable = lib.mkEnableOption "Enables idris language support"; + lang-agda.enable = lib.mkEnableOption "Enables agda language support"; lang-coq.enable = lib.mkEnableOption "Enables coq language support"; lang-lean.enable = lib.mkEnableOption "Enables lean language support"; lang-haskell.enable = lib.mkEnableOption "Enables haskell language support"; @@ -1514,6 +1884,7 @@ I have many imports that we'll go through next. gnumake bear clang-tools + autotools-language-server ]) else []) ++ (if config.monorepo.profiles.workstation.enable then (with pkgs; [ @@ -1567,6 +1938,15 @@ I have many imports that we'll go through next. (if config.monorepo.profiles.lang-lean.enable then (with pkgs; [ lean4 ]) else []) + ++ + (if config.monorepo.profiles.lang-agda.enable then (with pkgs; [ + agda + ]) else []) + ++ + (if config.monorepo.profiles.lang-idris.enable then (with pkgs; [ + idris + idris2Packages.idris2Lsp + ]) else []) ++ (if config.monorepo.profiles.lang-nix.enable then (with pkgs; [ nil @@ -1630,6 +2010,8 @@ I have many imports that we'll go through next. lang-coq.enable = lib.mkDefault config.monorepo.profiles.enable; lang-lean.enable = lib.mkDefault config.monorepo.profiles.enable; lang-haskell.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-idris.enable = lib.mkDefault config.monorepo.profiles.enable; + lang-agda.enable = lib.mkDefault config.monorepo.profiles.enable; crypto.enable = lib.mkDefault config.monorepo.profiles.enable; art.enable = lib.mkDefault config.monorepo.profiles.enable; @@ -1942,10 +2324,14 @@ as an org file which gets automatically tangled to an emacs-lisp file. enable = lib.mkDefault config.monorepo.profiles.graphics.enable; package = pkgs.emacs-pgtk; extraConfig = '' - (setq debug-on-error t) - (org-babel-load-file - (expand-file-name "~/monorepo/config/emacs.org"))''; + (setq debug-on-error t) + (setq system-email "${config.monorepo.profiles.email.email}") + (setq system-username "${config.monorepo.vars.internetName}") + (setq system-fullname "${config.monorepo.vars.fullName}") + (org-babel-load-file + (expand-file-name "~/${config.monorepo.vars.repoName}/config/emacs.org"))''; extraPackages = epkgs: [ + epkgs.agda2-mode epkgs.all-the-icons epkgs.auctex epkgs.catppuccin-theme @@ -1954,6 +2340,7 @@ as an org file which gets automatically tangled to an emacs-lisp file. epkgs.company-solidity epkgs.counsel epkgs.dashboard + epkgs.doom-themes epkgs.doom-modeline epkgs.elfeed epkgs.elfeed-org @@ -1976,6 +2363,7 @@ as an org file which gets automatically tangled to an emacs-lisp file. epkgs.gruvbox-theme epkgs.haskell-mode epkgs.htmlize + epkgs.idris-mode epkgs.irony-eldoc epkgs.ivy epkgs.ivy-pass @@ -1985,6 +2373,7 @@ as an org file which gets automatically tangled to an emacs-lisp file. epkgs.lsp-mode epkgs.lsp-haskell epkgs.lyrics-fetcher + epkgs.mastodon epkgs.magit epkgs.magit-delta epkgs.mu4e @@ -2157,6 +2546,7 @@ to use this component will come soon. "$mod, B, exec, bitcoin-qt" "$mod, M, exec, monero-wallet-gui" "$mod, V, exec, vesktop" + "$mod, C, exec, fluffychat" "$mod, D, exec, wofi --show run" "$mod, P, exec, bash ${scripts}/powermenu.sh" "$mod, Q, killactive" @@ -2322,7 +2712,7 @@ encrypted. This module uses the ~vars.nix~ as well as the home ~default.nix~ opt programs.mbsync = { enable = lib.mkDefault config.monorepo.profiles.email.enable; extraConfig = '' - IMAPAccount ret2pop + IMAPAccount ${config.monorepo.vars.internetName} Host ${config.monorepo.profiles.email.imapsServer} User ${config.monorepo.profiles.email.email} PassCmd "cat ${config.sops.secrets.mail.path}" @@ -2331,17 +2721,17 @@ encrypted. This module uses the ~vars.nix~ as well as the home ~default.nix~ opt AuthMechs * CertificateFile /etc/ssl/certs/ca-certificates.crt - IMAPStore ret2pop-remote - Account ret2pop + IMAPStore ${config.monorepo.vars.internetName}-remote + Account ${config.monorepo.vars.internetName} - MaildirStore ret2pop-local - Path ~/email/ret2pop/ - Inbox ~/email/ret2pop/INBOX + MaildirStore ${config.monorepo.vars.internetName}-local + Path ~/email/${config.monorepo.vars.internetName}/ + Inbox ~/email/${config.monorepo.vars.internetName}/INBOX SubFolders Verbatim - Channel ret2pop - Far :ret2pop-remote: - Near :ret2pop-local: + Channel ${config.monorepo.vars.internetName} + Far :${config.monorepo.vars.internetName}-remote: + Near :${config.monorepo.vars.internetName}-local: Patterns * Create Near Sync All @@ -3015,6 +3405,7 @@ standard. }; shellAliases = { + get-channel-id = "yt-dlp --print \"%(channel_id)s\" --playlist-end 1 \"$1\""; se = "sops edit"; f = "vim $(fzf)"; e = "cd $(find . -type d -print | fzf)"; @@ -3024,9 +3415,9 @@ standard. py = "python3"; rb = "sudo nixos-rebuild switch --flake $HOME/monorepo/nix#${systemHostName}"; nfu = "cd ~/monorepo/nix && git add . && git commit -m \"new flake lock\" && nix flake update"; - usync = "rsync -azvP --chmod=\"Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r\" ~/website_html/ root@${config.monorepo.vars.remoteHost}:/var/www/ret2pop-website/"; + usync = "rsync -azvP --chmod=\"Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r\" ~/website_html/ root@${config.monorepo.vars.remoteHost}:/var/www/${config.monorepo.vars.internetName}-website/"; usite - = "cd ~/src/publish-org-roam-ui && bash local.sh && rm -rf ~/website_html/graph_view; cp -r ~/src/publish-org-roam-ui/out ~/website_html/graph_view && rsync -azvP --chmod=\"Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r\" ~/website_html/ root@${config.monorepo.vars.remoteHost}:/var/www/ret2pop-website/"; + = "cd ~/src/publish-org-roam-ui && bash local.sh && rm -rf ~/website_html/graph_view; cp -r ~/src/publish-org-roam-ui/out ~/website_html/graph_view && rsync -azvP --chmod=\"Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r\" ~/website_html/ root@${config.monorepo.vars.remoteHost}:/var/www/${config.monorepo.vars.internetName}-website/"; sai = "eval \"$(ssh-agent -s)\" && ssh-add ~/.ssh/id_ed25519 && ssh-add -l"; i3 = "exec ${pkgs.i3-gaps}/bin/i3"; }; @@ -3052,7 +3443,7 @@ matrix server while having encryption. SSL = true; }; local-matrix = { - Homeserver = "https://social.nullring.xyz"; + Homeserver = "https://matrix.${config.monorepo.vars.orgHost}"; ListenAddress = "127.0.0.1"; ListenPort = "8008"; }; @@ -3069,8 +3460,8 @@ for these configurations. { home = { activation.startup-files = lib.hm.dag.entryAfter [ "installPackages" ] '' - if [ ! -d "/home/${config.monorepo.vars.userName}/email/ret2pop/" ]; then - mkdir -p /home/${config.monorepo.vars.userName}/email/ret2pop/ + if [ ! -d "/home/${config.monorepo.vars.userName}/email/${config.monorepo.vars.internetName}/" ]; then + mkdir -p /home/${config.monorepo.vars.userName}/email/${config.monorepo.vars.internetName}/ fi if [ ! -d "/home/${config.monorepo.vars.userName}/music" ]; then mkdir -p /home/${config.monorepo.vars.userName}/music @@ -3108,7 +3499,7 @@ for these configurations. # Apps # octaveFull - vesktop grim swww vim telegram-desktop qwen-code + vesktop grim swww vim telegram-desktop qwen-code fluffychat # Sound/media pavucontrol alsa-utils imagemagick ffmpeg helvum @@ -3120,7 +3511,7 @@ for these configurations. torsocks tor-browser # fonts - nerd-fonts.iosevka noto-fonts noto-fonts-cjk-sans noto-fonts-emoji fira-code font-awesome_6 + nerd-fonts.iosevka noto-fonts noto-fonts-cjk-sans noto-fonts-emoji fira-code font-awesome_6 victor-mono (aspellWithDicts (dicts: with dicts; [ en en-computers en-science ])) @@ -3221,7 +3612,6 @@ the path. { config, sops-nix, ... }: { home-manager = { - sharedModules = [ sops-nix.homeManagerModules.sops ]; @@ -3231,16 +3621,27 @@ the path. }; } #+end_src -** Includes +** Common These are the common includes for each of my systems. This ensures that we don't have to duplicate includes every time we want to add a new -system. -#+begin_src nix :tangle ../nix/systems/includes.nix +system. Also more common configuration can go here. +#+begin_src nix :tangle ../nix/systems/common.nix { config, lib, ... }: { imports = [ ./home.nix ../modules/default.nix ]; + # Put configuration (e.g. monorepo variable configuration) common to all configs here + } +#+end_src +** Home Manager Common +#+begin_src nix :tangle ../nix/systems/home-common.nix + { lib, config, ... }: + { + imports = [ + ../modules/home/default.nix + ]; + # Put configuration (e.g. monorepo variable configuration) common to all configs here } #+end_src ** Continuity @@ -3250,11 +3651,16 @@ This is pretty understandable, if you understand all the above. { imports = [ ../../disko/drive-simple.nix - ../includes.nix + ../common.nix ]; config = { - # drive to install to - monorepo.vars.device = "/dev/sda"; + monorepo = { + profiles.impermanence.enable = true; + vars = { + device = "/dev/sda"; + fileSystem = "btrfs"; + }; + }; }; } #+end_src @@ -3265,7 +3671,7 @@ monorepo home options. { lib, config, pkgs, ... }: { imports = [ - ../../modules/home/default.nix + ../home-common.nix ]; config.monorepo.profiles.workstation.enable = false; } @@ -3277,7 +3683,7 @@ as several other useful services. { config, lib, home-manager, ... }: { imports = [ - ../includes.nix + ../common.nix ../../disko/drive-simple.nix ]; config = { @@ -3297,7 +3703,7 @@ as several other useful services. { lib, config, pkgs, ... }: { imports = [ - ../../modules/home/default.nix + ../home-common.nix ]; config.monorepo = { profiles.cuda.enable = true; @@ -3308,12 +3714,17 @@ as several other useful services. Spontaneity is my VPS instance. #+begin_src nix :tangle ../nix/systems/spontaneity/default.nix { config, lib, ... }: + let + ipv4addr = "66.42.84.130"; + ipv6addr = "2001:19f0:5401:10d0:5400:5ff:fe4a:7794"; + in { imports = [ - ../includes.nix + ../common.nix + ../../disko/drive-bios.nix + # nixos-anywhere generates this file ./hardware-configuration.nix - ../../disko/drive-bios.nix ]; config = { monorepo = { @@ -3329,7 +3740,7 @@ Spontaneity is my VPS instance. networking = { interfaces.ens3.ipv6.addresses = [ { - address = "2001:19f0:5401:10d0:5400:5ff:fe4a:7794"; + address = ipv6addr; prefixLength = 64; } ]; @@ -3348,12 +3759,12 @@ Spontaneity is my VPS instance. enable = true; baseDomains = { "${config.monorepo.vars.remoteHost}" = { - a.data = "66.42.84.130"; - aaaa.data = "2001:19f0:5401:10d0:5400:5ff:fe4a:7794"; + a.data = ipv4addr; + aaaa.data = ipv6addr; }; - "nullring.xyz" = { - a.data = "66.42.84.130"; - aaaa.data = "2001:19f0:5401:10d0:5400:5ff:fe4a:7794"; + "${config.monorepo.vars.orgHost}" = { + a.data = ipv4addr; + aaaa.data = ipv6addr; }; }; subDomains = { @@ -3364,12 +3775,12 @@ Spontaneity is my VPS instance. mx.data = "10 mail.${config.monorepo.vars.remoteHost}."; }; - "nullring.xyz" = {}; - "git.nullring.xyz" = {}; - "matrix.nullring.xyz" = {}; - "talk.nullring.xyz" = {}; - "mail.nullring.xyz" = {}; - "ret2pop.nullring.xyz" = {}; + "${config.monorepo.vars.orgHost}" = {}; + "git.${config.monorepo.vars.orgHost}" = {}; + "matrix.${config.monorepo.vars.orgHost}" = {}; + "talk.${config.monorepo.vars.orgHost}" = {}; + "mail.${config.monorepo.vars.orgHost}" = {}; + "${config.monorepo.vars.internetName}.${config.monorepo.vars.orgHost}" = {}; }; }; }; @@ -3381,7 +3792,7 @@ Spontaneity is my VPS instance. { lib, config, pkgs, ... }: { imports = [ - ../../modules/home/default.nix + ../home-common.nix ]; config.monorepo.profiles.enable = false; } @@ -3455,6 +3866,10 @@ This contains the installation script I use to install my systems. exit 1 fi + gum style --border normal --margin "1" --padding "1 2" "Notice: if using full disk encryption, write to /tmp/secret.key first with your password." + + sleep 3 + cd "$HOME" ping -q -c1 google.com &>/dev/null && echo "online! Proceeding with the installation..." || nmtui @@ -3507,7 +3922,7 @@ This contains the installation script I use to install my systems. gum input --placeholder "Press Enter to continue" >/dev/null vim "$HOME/monorepo/nix/systems/$SYSTEM/home.nix" - sed -i "/# add hostnames here/i \ \"$1\"" "$HOME/monorepo/nix/flake.nix" + sed -i "/hostnames = \[/,/];/ s/];/ \"$1\"\n ];/" "$HOME/monorepo/nix/flake.nix" if [ ! -f "$HOME/monorepo/nix/disko/$DRIVE" ]; then cp "$HOME/monorepo/nix/disko/drive-simple.nix" "$HOME/monorepo/nix/disko/$DRIVE" @@ -3557,27 +3972,3 @@ This contains the installation script I use to install my systems. }; } #+end_src -* Add System Script -Here is a script to add a new system automatically: -#+begin_src bash :tangle ../nix/add-system.sh - #!/usr/bin/env bash - sed -i "/# add hostnames here/i \ \"$1\"" "$HOME/monorepo/nix/flake.nix" - sed -i "/# add hostnames here/i \ \"$1\"" "$HOME/monorepo/config/nix.org" - - mkdir -p "$HOME/monorepo/nix/systems/$1" - - cat > "$HOME/monorepo/nix/systems/$1/default.nix" < +#+html_head: +#+html_head: +#+options: broken-links:t +* Friday, 12 September 2025 +** 23:46 +Charlie Kirk died. diff --git a/journal/20250914.org b/journal/20250914.org new file mode 100644 index 0000000..893d33e --- /dev/null +++ b/journal/20250914.org @@ -0,0 +1,12 @@ +#+TITLE: Daily Journal +#+STARTUP: showeverything +#+DESCRIPTION: My daily journal entry +#+AUTHOR: Preston Pan +#+HTML_HEAD: +#+html_head: +#+html_head: +#+options: broken-links:t +* Sunday, 14 September 2025 +** 02:17 +I'm working on some more topology, specifically relating to product spaces. I also plan on cleaning up my house today. +A lot of my life is solitary, and in many ways that is nice. diff --git a/journal/20250915.org b/journal/20250915.org new file mode 100644 index 0000000..57e2dfe --- /dev/null +++ b/journal/20250915.org @@ -0,0 +1,11 @@ +#+TITLE: Daily Journal +#+STARTUP: showeverything +#+DESCRIPTION: My daily journal entry +#+AUTHOR: Preston Pan +#+HTML_HEAD: +#+html_head: +#+html_head: +#+options: broken-links:t +* Monday, 15 September 2025 +** 01:19 +I am currently trying to do the practice problems for this chapter. diff --git a/journal/20250916.org b/journal/20250916.org new file mode 100644 index 0000000..62afc7e --- /dev/null +++ b/journal/20250916.org @@ -0,0 +1,12 @@ +#+TITLE: Daily Journal +#+STARTUP: showeverything +#+DESCRIPTION: My daily journal entry +#+AUTHOR: Preston Pan +#+HTML_HEAD: +#+html_head: +#+html_head: +#+options: broken-links:t +* Tuesday, 16 September 2025 +** 03:13 +I am doing more topology, and i'm realizing that these questions related to product spaces are easy. +Still, I hope that I'm able to complete this fast enough. diff --git a/journal/20250917.org b/journal/20250917.org new file mode 100644 index 0000000..8833c07 --- /dev/null +++ b/journal/20250917.org @@ -0,0 +1,12 @@ +#+TITLE: Daily Journal +#+STARTUP: showeverything +#+DESCRIPTION: My daily journal entry +#+AUTHOR: Preston Pan +#+HTML_HEAD: +#+html_head: +#+html_head: +#+options: broken-links:t +* Wednesday, 17 September 2025 +** 03:39 +I just set up the discord-matrix bridge, and I ate with my friend today. I have been a bit tired recently; +I should figure out what's up with that with a blood test at some point. diff --git a/nix/add-system.sh b/nix/add-system.sh deleted file mode 100755 index bd7d0cf..0000000 --- a/nix/add-system.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/usr/bin/env bash -sed -i "/# add hostnames here/i \ \"$1\"" "$HOME/monorepo/nix/flake.nix" -sed -i "/# add hostnames here/i \ \"$1\"" "$HOME/monorepo/config/nix.org" - -mkdir -p "$HOME/monorepo/nix/systems/$1" - -cat > "$HOME/monorepo/nix/systems/$1/default.nix" </dev/null && echo "online! Proceeding with the installation..." || nmtui @@ -102,7 +106,7 @@ EOF gum input --placeholder "Press Enter to continue" >/dev/null vim "$HOME/monorepo/nix/systems/$SYSTEM/home.nix" - sed -i "/# add hostnames here/i \ \"$1\"" "$HOME/monorepo/nix/flake.nix" + sed -i "/hostnames = \[/,/];/ s/];/ \"$1\"\n ];/" "$HOME/monorepo/nix/flake.nix" if [ ! -f "$HOME/monorepo/nix/disko/$DRIVE" ]; then cp "$HOME/monorepo/nix/disko/drive-simple.nix" "$HOME/monorepo/nix/disko/$DRIVE" diff --git a/nix/systems/spontaneity/default.nix b/nix/systems/spontaneity/default.nix index 3ab7a9e..5f3dc36 100644 --- a/nix/systems/spontaneity/default.nix +++ b/nix/systems/spontaneity/default.nix @@ -1,10 +1,15 @@ { config, lib, ... }: +let + ipv4addr = "66.42.84.130"; + ipv6addr = "2001:19f0:5401:10d0:5400:5ff:fe4a:7794"; +in { imports = [ - ../includes.nix + ../common.nix + ../../disko/drive-bios.nix + # nixos-anywhere generates this file ./hardware-configuration.nix - ../../disko/drive-bios.nix ]; config = { monorepo = { @@ -20,43 +25,47 @@ networking = { interfaces.ens3.ipv6.addresses = [ { - address = "2001:19f0:5401:10d0:5400:5ff:fe4a:7794"; + address = ipv6addr; prefixLength = 64; } ]; firewall.allowedTCPPorts = [ 80 + 143 443 465 + 587 993 - 8448 6697 6667 + 8448 ]; domains = { enable = true; baseDomains = { "${config.monorepo.vars.remoteHost}" = { - a.data = "66.42.84.130"; - aaaa.data = "2001:19f0:5401:10d0:5400:5ff:fe4a:7794"; + a.data = ipv4addr; + aaaa.data = ipv6addr; }; - "nullring.xyz" = { - a.data = "66.42.84.130"; - aaaa.data = "2001:19f0:5401:10d0:5400:5ff:fe4a:7794"; + "${config.monorepo.vars.orgHost}" = { + a.data = ipv4addr; + aaaa.data = ipv6addr; }; }; subDomains = { "${config.monorepo.vars.remoteHost}" = {}; "matrix.${config.monorepo.vars.remoteHost}" = {}; "www.${config.monorepo.vars.remoteHost}" = {}; - "mail.${config.monorepo.vars.remoteHost}" = {}; + "mail.${config.monorepo.vars.remoteHost}" = { + mx.data = "10 mail.${config.monorepo.vars.remoteHost}."; + }; - "nullring.xyz" = {}; - "git.nullring.xyz" = {}; - "matrix.nullring.xyz" = {}; - "talk.nullring.xyz" = {}; - "mail.nullring.xyz" = {}; - "ret2pop.nullring.xyz" = {}; + "${config.monorepo.vars.orgHost}" = {}; + "git.${config.monorepo.vars.orgHost}" = {}; + "matrix.${config.monorepo.vars.orgHost}" = {}; + "talk.${config.monorepo.vars.orgHost}" = {}; + "mail.${config.monorepo.vars.orgHost}" = {}; + "${config.monorepo.vars.internetName}.${config.monorepo.vars.orgHost}" = {}; }; }; }; diff --git a/nix/systems/spontaneity/home.nix b/nix/systems/spontaneity/home.nix index cc93b5d..205ea02 100644 --- a/nix/systems/spontaneity/home.nix +++ b/nix/systems/spontaneity/home.nix @@ -1,7 +1,7 @@ { lib, config, pkgs, ... }: { imports = [ - ../../modules/home/default.nix + ../home-common.nix ]; config.monorepo.profiles.enable = false; }