From c46325d82f3a325021811f1be844ba24b0ee5688 Mon Sep 17 00:00:00 2001 From: Preston Pan Date: Sun, 1 Mar 2026 15:05:36 -0800 Subject: add nice keybindings and options for hyprland; start of rpi-zero --- config/emacs.org | 114 ++++++++++++------------- config/nix.org | 166 ++++++++++++++++++++++++++---------- nix/flake.nix | 79 ++++++++++------- nix/flakevars.nix | 1 + nix/init.el | 2 +- nix/modules/home/default.nix | 1 + nix/modules/home/firefox.nix | 4 +- nix/modules/home/hyprland.nix | 15 ++-- nix/modules/home/pantalaimon.nix | 8 +- nix/modules/home/user.nix | 2 +- nix/modules/pantalaimon.nix | 13 +++ nix/systems/rpi-zero/default.nix | 22 +++++ nix/systems/rpi-zero/home.nix | 7 ++ nix/systems/spontaneity/default.nix | 7 +- 14 files changed, 294 insertions(+), 147 deletions(-) create mode 100644 nix/modules/pantalaimon.nix create mode 100644 nix/systems/rpi-zero/default.nix create mode 100644 nix/systems/rpi-zero/home.nix diff --git a/config/emacs.org b/config/emacs.org index 642377d..d17f1f8 100644 --- a/config/emacs.org +++ b/config/emacs.org @@ -133,63 +133,63 @@ of course Emacs was not designed to be fully imperative. ** Org Mode This is my org mode configuration, which also configures latex. #+begin_src emacs-lisp :tangle ../nix/init.el - (use-package org - :hook - ((org-mode-hook . (lambda () (remove-hook 'post-self-insert-hook #'yaml-electric-bar-and-angle t)))) - :custom - (org-confirm-babel-evaluate nil "Don't ask to evaluate code block") - (org-export-with-broken-links t "publish website even with broken links") - (org-src-fontify-natively t "Colors!") - (org-latex-preview-image-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location") - (org-preview-latex-image-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location") - (TeX-PDF-mode t) - (org-latex-compiler "xelatex" "Use latex as default") - (org-latex-pdf-process '("xelatex -interaction=nonstopmode -output-directory=%o %f") "set xelatex as default") - (TeX-engine 'xetex "set xelatex as default engine") - (preview-default-option-list '("displaymath" "textmath" "graphics") "preview latex") - (preview-image-type 'png "Use PNGs") -;; (org-format-latex-options (plist-put org-format-latex-options :scale 1.5) "space latex better") - (org-return-follows-link t "be able to follow links without mouse") - (org-habit-preceding-days 7 "See org habit entries") - (org-habit-following-days 35 "See org habit entries") - (org-habit-show-habits t "See org habit entries") - (org-habit-show-habits-only-for-today nil "See org habit entries") - (org-habit-show-all-today t "Show org habit graph") - (org-startup-indented t "Indent the headings") - (org-image-actual-width '(300) "Cap width") - (org-startup-with-latex-preview t "see latex previews on opening file") - (org-startup-with-inline-images t "See images on opening file") - (org-hide-emphasis-markers t "prettify org mode") - (org-use-sub-superscripts "{}" "Only display superscripts and subscripts when enclosed in {}") - (org-pretty-entities t "prettify org mode") - (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 (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)))) + (use-package org + :hook + ((org-mode-hook . (lambda () (remove-hook 'post-self-insert-hook #'yaml-electric-bar-and-angle t)))) + :custom + (org-confirm-babel-evaluate nil "Don't ask to evaluate code block") + (org-export-with-broken-links t "publish website even with broken links") + (org-src-fontify-natively t "Colors!") + (org-latex-preview-image-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location") + (org-preview-latex-image-directory (expand-file-name "~/.cache/ltximg/") "don't use weird cache location") + (TeX-PDF-mode t) + (org-latex-compiler "xelatex" "Use latex as default") + (org-latex-pdf-process '("xelatex -interaction=nonstopmode -output-directory=%o %f") "set xelatex as default") + (TeX-engine 'xetex "set xelatex as default engine") + (preview-default-option-list '("displaymath" "textmath" "graphics") "preview latex") + (preview-image-type 'png "Use PNGs") + ;; (org-format-latex-options (plist-put org-format-latex-options :scale 1.5) "space latex better") + (org-return-follows-link t "be able to follow links without mouse") + (org-habit-preceding-days 7 "See org habit entries") + (org-habit-following-days 35 "See org habit entries") + (org-habit-show-habits t "See org habit entries") + (org-habit-show-habits-only-for-today nil "See org habit entries") + (org-habit-show-all-today t "Show org habit graph") + (org-startup-indented t "Indent the headings") + (org-image-actual-width '(300) "Cap width") + (org-startup-with-latex-preview t "see latex previews on opening file") + (org-startup-with-inline-images t "See images on opening file") + (org-hide-emphasis-markers t "prettify org mode") + (org-use-sub-superscripts "{}" "Only display superscripts and subscripts when enclosed in {}") + (org-pretty-entities t "prettify org mode") + (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\\|txt" + :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)))) #+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) diff --git a/config/nix.org b/config/nix.org index 171726f..4aff74c 100644 --- a/config/nix.org +++ b/config/nix.org @@ -33,6 +33,7 @@ We start with some configurable variables (you can change these if you want to u # Hostnames of my systems hostnames = [ + "rpi-zero" "affinity" "continuity" "spontaneity" @@ -116,7 +117,10 @@ and now for the main flake: let vars = import ./flakevars.nix; system = "x86_64-linux"; + pkgs = import nixpkgs { inherit system; }; + armPkgs = import nixpkgs { inherit system; }; + generate = nixos-dns.utils.generate nixpkgs.legacyPackages."${system}"; dnsConfig = { @@ -125,38 +129,50 @@ and now for the main flake: }; # 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 - ]; - } - 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") - ]; - }; - }); + mkConfigs = map (hostname: + let + isRpi = (builtins.match "rpi-.*" hostname) != null; + hostSystem = if isRpi then "aarch64-linux" else system; + in + { + name = "${hostname}"; + value = nixpkgs.lib.nixosSystem { + system = hostSystem; + specialArgs = attrs; + modules = if (hostname == "installer") then [ + (./. + "/systems/${hostname}/default.nix") + { networking.hostName = "${hostname}"; } + nix-topology.nixosModules.default + ] else (if isRpi then [ + (./. + "/systems/${hostname}/default.nix") + disko.nixosModules.disko + home-manager.nixosModules.home-manager + sops-nix.nixosModules.sops + lanzaboote.nixosModules.lanzaboote + ] 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}"; @@ -2690,6 +2706,7 @@ I have many imports that we'll go through next. ./user.nix ./gtk.nix ./secrets.nix + ./pantalaimon.nix ]; options = { @@ -2926,7 +2943,9 @@ be straightforward. vimium privacy-redirect ] ++ (lib.optional config.monorepo.profiles.crypto.enable pkgs.nur.repos.rycee.firefox-addons.metamask); - + settings = { + "privacy.resistFingerprinting.letterboxing" = true; + }; }; }; }; @@ -3195,13 +3214,18 @@ to use this component will come soon. workspace = 2; } { - name = "element-desktop"; - "match:class" = "element-desktop"; + name = "chromium-browser"; + "match:class" = "chromium-browser"; + workspace = 2; + } + { + name = "signal"; + "match:class" = "signal"; workspace = 3; } { - name = "vesktop"; - "match:class" = "vesktop"; + name = "Element"; + "match:class" = "Element"; workspace = 3; } { @@ -3229,7 +3253,7 @@ to use this component will come soon. "$mod, S, exec, pavucontrol" "$mod, M, exec, monero-wallet-gui" "$mod, V, exec, element-desktop" - "$mod, C, exec, fluffychat" + "$mod, C, exec, signal-desktop" "$mod, D, exec, wofi --show run" "$mod, P, exec, bash ${scripts}/powermenu.sh" "$mod, Q, killactive" @@ -4052,6 +4076,28 @@ A classic program that allows you to download from youtube. Also has integration }; } #+end_src +*** pantalaimon +#+begin_src nix :tangle ../nix/modules/home/pantalaimon.nix + { lib, config, ... }: + { + services.pantalaimon = { + enable = lib.mkDefault config.monorepo.profiles.enable; + settings = { + Default = { + LogLevel = "Debug"; + SSL = true; + }; + + local-matrix = { + Homeserver = "https://matrix.nullring.xyz"; + ListenAddress = "127.0.0.1"; + ListenPort = 8008; + }; + }; + + }; + } +#+end_src *** Zsh My zsh config has some useful aliases that one should read through. Otherwise it is pretty standard. @@ -4158,7 +4204,7 @@ for these configurations. # Apps # octaveFull - grim swww vim kotatogram-desktop tg qwen-code element-desktop signal-desktop thunderbird jami + grim swww vim kotatogram-desktop tg qwen-code element-desktop signal-desktop signal-cli thunderbird jami # Sound/media pavucontrol alsa-utils imagemagick ffmpeg helvum @@ -4398,6 +4444,41 @@ I want cuda in home manager too. }; } #+end_src +** rpi-zero +#+begin_src nix :tangle ../nix/systems/rpi-zero/default.nix + { lib, config, home-manager, ... }: + { + imports = [ + ../common.nix + ]; + config = { + zramSwap = { + enable = true; + algorithm = "zstd"; + memoryPercent = 100; + }; + boot.loader.grub.enable = false; + boot.loader.generic-extlinux-compatible.enable = true; + monorepo = { + vars.device = "/dev/mmcblk0"; + profiles = { + server.enable = false; + ttyonly.enable = true; + }; + }; + }; + } +#+end_src +*** Home +#+begin_src nix :tangle ../nix/systems/rpi-zero/home.nix + { lib, config, pkgs, ... }: + { + imports = [ + ../home-common.nix + ]; + config.monorepo.profiles.enable = false; + } +#+end_src ** Spontaneity Spontaneity is my VPS instance. Note that much of this is not fully reproducible; you must change the IPs yourself and you must change some DNS records to match what you have on your system after deployment. @@ -4439,12 +4520,11 @@ some DNS records to match what you have on your system after deployment. systemd.network.networks."40-ens3" = { matchConfig.Name = "ens3"; networkConfig = { - # This is the magic combo for Vultr: - IPv6AcceptRA = true; # Accept routes (so we know where the internet is) - IPv6PrivacyExtensions = false; # No random privacy IPs + IPv6AcceptRA = true; + IPv6PrivacyExtensions = false; }; ipv6AcceptRAConfig = { - UseAutonomousPrefix = false; # Do NOT generate an IP address from the RA + UseAutonomousPrefix = false; }; }; networking = { diff --git a/nix/flake.nix b/nix/flake.nix index dad1072..86ce7ac 100644 --- a/nix/flake.nix +++ b/nix/flake.nix @@ -67,7 +67,10 @@ let vars = import ./flakevars.nix; system = "x86_64-linux"; + pkgs = import nixpkgs { inherit system; }; + armPkgs = import nixpkgs { inherit system; }; + generate = nixos-dns.utils.generate nixpkgs.legacyPackages."${system}"; dnsConfig = { @@ -76,38 +79,50 @@ }; # 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 - ]; - } - 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") - ]; - }; - }); + mkConfigs = map (hostname: + let + isRpi = (builtins.match "rpi-.*" hostname) != null; + hostSystem = if isRpi then "aarch64-linux" else system; + in + { + name = "${hostname}"; + value = nixpkgs.lib.nixosSystem { + system = hostSystem; + specialArgs = attrs; + modules = if (hostname == "installer") then [ + (./. + "/systems/${hostname}/default.nix") + { networking.hostName = "${hostname}"; } + nix-topology.nixosModules.default + ] else (if isRpi then [ + (./. + "/systems/${hostname}/default.nix") + disko.nixosModules.disko + home-manager.nixosModules.home-manager + sops-nix.nixosModules.sops + lanzaboote.nixosModules.lanzaboote + ] 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}"; diff --git a/nix/flakevars.nix b/nix/flakevars.nix index dd42616..e737e82 100644 --- a/nix/flakevars.nix +++ b/nix/flakevars.nix @@ -14,6 +14,7 @@ in # Hostnames of my systems hostnames = [ + "rpi-zero" "affinity" "continuity" "spontaneity" diff --git a/nix/init.el b/nix/init.el index d6358e4..10d6046 100644 --- a/nix/init.el +++ b/nix/init.el @@ -146,7 +146,7 @@ :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" + :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|ico\\|asc\\|pub\\|webmanifest\\|xml\\|svg\\|txt" :publishing-directory "~/website_html/" :recursive t :publishing-function org-publish-attachment) diff --git a/nix/modules/home/default.nix b/nix/modules/home/default.nix index 6e92c86..3eb4ad5 100644 --- a/nix/modules/home/default.nix +++ b/nix/modules/home/default.nix @@ -22,6 +22,7 @@ ./user.nix ./gtk.nix ./secrets.nix + ./pantalaimon.nix ]; options = { diff --git a/nix/modules/home/firefox.nix b/nix/modules/home/firefox.nix index df05517..d339ba8 100644 --- a/nix/modules/home/firefox.nix +++ b/nix/modules/home/firefox.nix @@ -16,7 +16,9 @@ vimium privacy-redirect ] ++ (lib.optional config.monorepo.profiles.crypto.enable pkgs.nur.repos.rycee.firefox-addons.metamask); - + settings = { + "privacy.resistFingerprinting.letterboxing" = true; + }; }; }; }; diff --git a/nix/modules/home/hyprland.nix b/nix/modules/home/hyprland.nix index 3e867cb..c836b81 100644 --- a/nix/modules/home/hyprland.nix +++ b/nix/modules/home/hyprland.nix @@ -58,13 +58,18 @@ workspace = 2; } { - name = "element-desktop"; - "match:class" = "element-desktop"; + name = "chromium-browser"; + "match:class" = "chromium-browser"; + workspace = 2; + } + { + name = "signal"; + "match:class" = "signal"; workspace = 3; } { - name = "vesktop"; - "match:class" = "vesktop"; + name = "Element"; + "match:class" = "Element"; workspace = 3; } { @@ -92,7 +97,7 @@ "$mod, S, exec, pavucontrol" "$mod, M, exec, monero-wallet-gui" "$mod, V, exec, element-desktop" - "$mod, C, exec, fluffychat" + "$mod, C, exec, signal-desktop" "$mod, D, exec, wofi --show run" "$mod, P, exec, bash ${scripts}/powermenu.sh" "$mod, Q, killactive" diff --git a/nix/modules/home/pantalaimon.nix b/nix/modules/home/pantalaimon.nix index b523865..b3a4d42 100644 --- a/nix/modules/home/pantalaimon.nix +++ b/nix/modules/home/pantalaimon.nix @@ -1,17 +1,19 @@ { lib, config, ... }: { services.pantalaimon = { - enable = lib.mkDefault config.monorepo.profiles.graphics.enable; + enable = lib.mkDefault config.monorepo.profiles.enable; settings = { Default = { LogLevel = "Debug"; SSL = true; }; + local-matrix = { - Homeserver = "https://matrix.${config.monorepo.vars.orgHost}"; + Homeserver = "https://matrix.nullring.xyz"; ListenAddress = "127.0.0.1"; - ListenPort = "8008"; + ListenPort = 8008; }; }; + }; } diff --git a/nix/modules/home/user.nix b/nix/modules/home/user.nix index 05729b1..fc8c2ae 100644 --- a/nix/modules/home/user.nix +++ b/nix/modules/home/user.nix @@ -47,7 +47,7 @@ # Apps # octaveFull - grim swww vim kotatogram-desktop tg qwen-code element-desktop signal-desktop thunderbird jami + grim swww vim kotatogram-desktop tg qwen-code element-desktop signal-desktop signal-cli thunderbird jami # Sound/media pavucontrol alsa-utils imagemagick ffmpeg helvum diff --git a/nix/modules/pantalaimon.nix b/nix/modules/pantalaimon.nix new file mode 100644 index 0000000..e82e50f --- /dev/null +++ b/nix/modules/pantalaimon.nix @@ -0,0 +1,13 @@ +{ lib, config, ... }: +{ + services.pantalaimon-headless = { + instances = { + "nullring" = { + ssl = true; + homeserver = "https://matrix.nullring.xyz"; + listenAddress = "localhost"; + listenPort = 8009; + }; + }; + }; +} diff --git a/nix/systems/rpi-zero/default.nix b/nix/systems/rpi-zero/default.nix new file mode 100644 index 0000000..f0e4dec --- /dev/null +++ b/nix/systems/rpi-zero/default.nix @@ -0,0 +1,22 @@ +{ lib, config, home-manager, ... }: +{ + imports = [ + ../common.nix + ]; + config = { + zramSwap = { + enable = true; + algorithm = "zstd"; + memoryPercent = 100; + }; + boot.loader.grub.enable = false; + boot.loader.generic-extlinux-compatible.enable = true; + monorepo = { + vars.device = "/dev/mmcblk0"; + profiles = { + server.enable = false; + ttyonly.enable = true; + }; + }; + }; +} diff --git a/nix/systems/rpi-zero/home.nix b/nix/systems/rpi-zero/home.nix new file mode 100644 index 0000000..205ea02 --- /dev/null +++ b/nix/systems/rpi-zero/home.nix @@ -0,0 +1,7 @@ +{ lib, config, pkgs, ... }: +{ + imports = [ + ../home-common.nix + ]; + config.monorepo.profiles.enable = false; +} diff --git a/nix/systems/spontaneity/default.nix b/nix/systems/spontaneity/default.nix index 9f33555..a7e78fc 100644 --- a/nix/systems/spontaneity/default.nix +++ b/nix/systems/spontaneity/default.nix @@ -35,12 +35,11 @@ systemd.network.networks."40-ens3" = { matchConfig.Name = "ens3"; networkConfig = { - # This is the magic combo for Vultr: - IPv6AcceptRA = true; # Accept routes (so we know where the internet is) - IPv6PrivacyExtensions = false; # No random privacy IPs + IPv6AcceptRA = true; + IPv6PrivacyExtensions = false; }; ipv6AcceptRAConfig = { - UseAutonomousPrefix = false; # Do NOT generate an IP address from the RA + UseAutonomousPrefix = false; }; }; networking = { -- cgit v1.3