guixsd-config

GuixSD configs for my systems
Log | Files | Refs

commit 179ce8fd15c3144457bf90ab9cddef28e5d488e4
parent d6f496e336d8b2e8b24f1fcfdf4a5fcd160af11a
Author: Vineet Kumar <git@vineetk.net>
Date:   Mon, 16 Nov 2026 23:40:22 +0100

demiurge: indent?

Diffstat:
Mepistemia/systems/demiurge.scm | 468++++++++++++++++++++++++++++++++++++++++----------------------------------------
1 file changed, 234 insertions(+), 234 deletions(-)

diff --git a/epistemia/systems/demiurge.scm b/epistemia/systems/demiurge.scm @@ -114,248 +114,248 @@ (stop #~(make-kill-destructor)))))) (operating-system - (inherit base-system) - (host-name "demiurge.epistemia") + (inherit base-system) + (host-name "demiurge.epistemia") - (users (cons (user-account - (name "vin") - (comment "Vineet") - (shell (file-append bash "/bin/bash")) - (group "users") - (supplementary-groups '("wheel" "audio" "video" "input" "seat" "tty" "kvm"))) - %base-user-accounts)) + (users (cons (user-account + (name "vin") + (comment "Vineet") + (shell (file-append bash "/bin/bash")) + (group "users") + (supplementary-groups '("wheel" "audio" "video" "input" "seat" "tty" "kvm"))) + %base-user-accounts)) - (kernel linux-7.2) - (kernel-arguments '("net.ifnames=0" - "amdgpu.ppfeaturemask=0xfff7ffff")) - (kernel-loadable-modules (list (list zfs-linux "module"))) + (kernel linux-7.2) + (kernel-arguments '("net.ifnames=0" + "amdgpu.ppfeaturemask=0xfff7ffff")) + (kernel-loadable-modules (list (list zfs-linux "module"))) - (initrd microcode-initrd) - (firmware (cons* amdgpu-firmware %base-firmware)) + (initrd microcode-initrd) + (firmware (cons* amdgpu-firmware %base-firmware)) - (file-systems (append - (list (file-system - (device (file-system-label "broot")) - (mount-point "/") - (type "btrfs") - (options "subvol=rootfs,compress-force=zstd,space_cache=v2")) - (file-system - (device (file-system-label "broot")) - (mount-point "/home") - (type "btrfs") - (options "subvol=home,compress-force=zstd,space_cache=v2")) - (file-system - (device (uuid "6567-7B70" 'fat)) - (mount-point "/boot/efi") - (type "vfat")) - (file-system - (device "none") - (mount-point "/home/vin/.local/state/runtime") - (type "tmpfs") - (options "uid=1000"))) - %base-file-systems)) + (file-systems (append + (list (file-system + (device (file-system-label "broot")) + (mount-point "/") + (type "btrfs") + (options "subvol=rootfs,compress-force=zstd,space_cache=v2")) + (file-system + (device (file-system-label "broot")) + (mount-point "/home") + (type "btrfs") + (options "subvol=home,compress-force=zstd,space_cache=v2")) + (file-system + (device (uuid "6567-7B70" 'fat)) + (mount-point "/boot/efi") + (type "vfat")) + (file-system + (device "none") + (mount-point "/home/vin/.local/state/runtime") + (type "tmpfs") + (options "uid=1000"))) + %base-file-systems)) - (packages (append (list emacs-no-x - git - zfs-linux) - %base-packages)) + (packages (append (list emacs-no-x + git + zfs-linux) + %base-packages)) - (services (modify-services (append (list (service age-secret-service-type - (age-secret-configuration - (secrets (list - (age-secret - (name "wg0_demiurge") - (file (local-file "../secrets/wg0_demiurge.age"))) - (age-secret - (name "wg1_demiurge") - (file (local-file "../secrets/wg1_demiurge.age"))))))) - (simple-service 'zfs-loader - kernel-module-loader-service-type - '("zfs")) - (simple-service 'zfs-shepherd-services - shepherd-root-service-type - zfs-shepherd-services) - (simple-service 'zfs-shepherd-services-user-processes - user-processes-service-type - '(zfs-automount)) - (simple-service 'gpu-power-cap - shepherd-root-service-type - (list (shepherd-service - (provision '(gpu-power-cap)) - (requirement '(udev)) - (one-shot? #t) - (documentation "Set GPU power cap on boot") - (start #~(make-forkexec-constructor - (list #$(file-append bash "/bin/bash") "-c" - (string-append - "echo 303000000 > /sys/class/drm/card0/device/hwmon/hwmon*/power1_cap; " - "echo 402000000 > /sys/class/drm/card1/device/hwmon/hwmon*/power1_cap")))) - (stop #~(make-kill-destructor))))) - (service seatd-service-type) - (service iptables-service-type) - (service static-networking-service-type - (list (static-networking - (addresses - (list (network-address - (device "eth0") - (value "192.168.88.4/24")))) - (routes - (list (network-route - (destination "default") - (gateway "192.168.88.1"))))))) - (simple-service 'resolv-configuration - etc-service-type - `(("resolv.conf" - ,(plain-file "epistemia_resolv.conf" - (string-append - "nameserver ::1\n" - "search epistemia\n"))))) - (service openssh-service-type - (openssh-configuration - (permit-root-login #f) - (authorized-keys - `(("vin" ,(local-file "/data/ssh/id_ed25519.pub")) - ("root" ,(local-file "/data/ssh/id_ed25519.pub")))))) - (service unbound-service-type - (unbound-configuration - (server - (unbound-server - (interface '("::1")) - (hide-version #t) - (hide-identity #t) - (extra-options '((ip-freebind . "yes" ) - (aggressive-nsec . "no"))))) - (forward-zone - (list - (unbound-zone - (name "epistemia.") - (forward-addr '("10.0.13.1"))))))) - (service wireguard-service-type - (wireguard-configuration - (interface "wg0") - (addresses '("172.26.55.213/32" "fd00:0000:1337:cafe:1111:1111:4975:4c1d/128")) - (port 51920) - (bootstrap-private-key? #f) - (private-key "/run/secrets/wg0_demiurge") - (pre-up '("while [ ! -f /run/secrets/wg0_demiurge ]; do sleep 1; done" - "ip route replace 185.157.162.7 via 192.168.88.1 dev eth0" - )) - (post-up - `("ip rule add fwmark 0x1 table 100 priority 100" - "ip rule add fwmark 51820 table 100 priority 100" - "ip route replace default via 192.168.88.1 dev eth0 table 100" - ,#~(string-append #$(file-append iptables "/sbin/iptables") " -t mangle -A PREROUTING -i eth0 -d 192.168.88.4 -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x1") - ,#~(string-append #$(file-append iptables "/sbin/iptables") " -t mangle -A PREROUTING -i eth0 -j CONNMARK --restore-mark") - ,#~(string-append #$(file-append iptables "/sbin/iptables") " -t mangle -A OUTPUT -m conntrack --ctstate ESTABLISHED,RELATED -j CONNMARK --restore-mark"))) - (post-down - `("ip route del 185.157.162.7 via 192.168.88.1 dev eth0" - "ip rule del fwmark 0x1 table 100" - "ip rule del fwmark 51820 table 100" - "ip route flush table 100" - ,#~(string-append #$(file-append iptables "/sbin/iptables") " -t mangle -D PREROUTING -i eth0 -d 192.168.88.4 -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x1") - ,#~(string-append #$(file-append iptables "/sbin/iptables") " -t mangle -D PREROUTING -i eth0 -j CONNMARK --restore-mark") - ,#~(string-append #$(file-append iptables "/sbin/iptables") " -t mangle -D OUTPUT -m conntrack --ctstate ESTABLISHED,RELATED -j CONNMARK --restore-mark"))) - (peers - (list - (wireguard-peer - (name "ovpn-ams-29") - (public-key "wTlz3u1egzUrx4Ho02cL7Ht1BBa/C8bULzXStn5f+zk=") - (allowed-ips '("0.0.0.0/0" "::0/0")) - (endpoint "185.157.162.7:9929")))))) - (service wireguard-service-type - (wireguard-configuration - (interface "wg1") - (addresses '("10.0.13.2/32")) - (port 51820) - (bootstrap-private-key? #f) - (private-key "/run/secrets/wg1_demiurge") - (table #f) - (shepherd-requirement '(age-secret - ;; to prevent iptables lock issues - ;; wireguard-wg0 - )) - (pre-up '("while [ ! -f /run/secrets/wg1_demiurge ]; do sleep 1; done")) - (post-up - ;; IPv4 and IPv6 NAT - (list #~(string-append #$(file-append iptables "/sbin/iptables") " -t nat -I POSTROUTING 1 -s 10.0.13.4/32 -o wg0 -j MASQUERADE") - #~(string-append #$(file-append iptables "/sbin/ip6tables") " -t nat -I POSTROUTING 1 -s fd00:b0ba:cafe:babe::4/128 -o wg0 -j MASQUERADE") - #~(string-append #$(file-append iptables "/sbin/iptables") " -N WG1-FWD") + (services (modify-services (append (list (service age-secret-service-type + (age-secret-configuration + (secrets (list + (age-secret + (name "wg0_demiurge") + (file (local-file "../secrets/wg0_demiurge.age"))) + (age-secret + (name "wg1_demiurge") + (file (local-file "../secrets/wg1_demiurge.age"))))))) + (simple-service 'zfs-loader + kernel-module-loader-service-type + '("zfs")) + (simple-service 'zfs-shepherd-services + shepherd-root-service-type + zfs-shepherd-services) + (simple-service 'zfs-shepherd-services-user-processes + user-processes-service-type + '(zfs-automount)) + (simple-service 'gpu-power-cap + shepherd-root-service-type + (list (shepherd-service + (provision '(gpu-power-cap)) + (requirement '(udev)) + (one-shot? #t) + (documentation "Set GPU power cap on boot") + (start #~(make-forkexec-constructor + (list #$(file-append bash "/bin/bash") "-c" + (string-append + "echo 303000000 > /sys/class/drm/card0/device/hwmon/hwmon*/power1_cap; " + "echo 402000000 > /sys/class/drm/card1/device/hwmon/hwmon*/power1_cap")))) + (stop #~(make-kill-destructor))))) + (service seatd-service-type) + (service iptables-service-type) + (service static-networking-service-type + (list (static-networking + (addresses + (list (network-address + (device "eth0") + (value "192.168.88.4/24")))) + (routes + (list (network-route + (destination "default") + (gateway "192.168.88.1"))))))) + (simple-service 'resolv-configuration + etc-service-type + `(("resolv.conf" + ,(plain-file "epistemia_resolv.conf" + (string-append + "nameserver ::1\n" + "search epistemia\n"))))) + (service openssh-service-type + (openssh-configuration + (permit-root-login #f) + (authorized-keys + `(("vin" ,(local-file "/data/ssh/id_ed25519.pub")) + ("root" ,(local-file "/data/ssh/id_ed25519.pub")))))) + (service unbound-service-type + (unbound-configuration + (server + (unbound-server + (interface '("::1")) + (hide-version #t) + (hide-identity #t) + (extra-options '((ip-freebind . "yes" ) + (aggressive-nsec . "no"))))) + (forward-zone + (list + (unbound-zone + (name "epistemia.") + (forward-addr '("10.0.13.1"))))))) + (service wireguard-service-type + (wireguard-configuration + (interface "wg0") + (addresses '("172.26.55.213/32" "fd00:0000:1337:cafe:1111:1111:4975:4c1d/128")) + (port 51920) + (bootstrap-private-key? #f) + (private-key "/run/secrets/wg0_demiurge") + (pre-up '("while [ ! -f /run/secrets/wg0_demiurge ]; do sleep 1; done" + "ip route replace 185.157.162.7 via 192.168.88.1 dev eth0" + )) + (post-up + `("ip rule add fwmark 0x1 table 100 priority 100" + "ip rule add fwmark 51820 table 100 priority 100" + "ip route replace default via 192.168.88.1 dev eth0 table 100" + ,#~(string-append #$(file-append iptables "/sbin/iptables") " -t mangle -A PREROUTING -i eth0 -d 192.168.88.4 -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x1") + ,#~(string-append #$(file-append iptables "/sbin/iptables") " -t mangle -A PREROUTING -i eth0 -j CONNMARK --restore-mark") + ,#~(string-append #$(file-append iptables "/sbin/iptables") " -t mangle -A OUTPUT -m conntrack --ctstate ESTABLISHED,RELATED -j CONNMARK --restore-mark"))) + (post-down + `("ip route del 185.157.162.7 via 192.168.88.1 dev eth0" + "ip rule del fwmark 0x1 table 100" + "ip rule del fwmark 51820 table 100" + "ip route flush table 100" + ,#~(string-append #$(file-append iptables "/sbin/iptables") " -t mangle -D PREROUTING -i eth0 -d 192.168.88.4 -m conntrack --ctstate NEW -j CONNMARK --set-mark 0x1") + ,#~(string-append #$(file-append iptables "/sbin/iptables") " -t mangle -D PREROUTING -i eth0 -j CONNMARK --restore-mark") + ,#~(string-append #$(file-append iptables "/sbin/iptables") " -t mangle -D OUTPUT -m conntrack --ctstate ESTABLISHED,RELATED -j CONNMARK --restore-mark"))) + (peers + (list + (wireguard-peer + (name "ovpn-ams-29") + (public-key "wTlz3u1egzUrx4Ho02cL7Ht1BBa/C8bULzXStn5f+zk=") + (allowed-ips '("0.0.0.0/0" "::0/0")) + (endpoint "185.157.162.7:9929")))))) + ;; (service wireguard-service-type + ;; (wireguard-configuration + ;; (interface "wg1") + ;; (addresses '("10.0.13.2/32")) + ;; (port 51820) + ;; (bootstrap-private-key? #f) + ;; (private-key "/run/secrets/wg1_demiurge") + ;; (table #f) + ;; (shepherd-requirement '(age-secret + ;; ;; to prevent iptables lock issues + ;; ;; wireguard-wg0 + ;; )) + ;; (pre-up '("while [ ! -f /run/secrets/wg1_demiurge ]; do sleep 1; done")) + ;; (post-up + ;; ;; IPv4 and IPv6 NAT + ;; (list #~(string-append #$(file-append iptables "/sbin/iptables") " -t nat -I POSTROUTING 1 -s 10.0.13.4/32 -o wg0 -j MASQUERADE") + ;; #~(string-append #$(file-append iptables "/sbin/ip6tables") " -t nat -I POSTROUTING 1 -s fd00:b0ba:cafe:babe::4/128 -o wg0 -j MASQUERADE") + ;; #~(string-append #$(file-append iptables "/sbin/iptables") " -N WG1-FWD") - ;; IPv4 Forwarding Chain - #~(string-append #$(file-append iptables "/sbin/iptables") " -I FORWARD 1 -j WG1-FWD") - #~(string-append #$(file-append iptables "/sbin/iptables") " -A WG1-FWD -i wg1 -o wg1 -j ACCEPT") - #~(string-append #$(file-append iptables "/sbin/iptables") " -A WG1-FWD -i wg1 -o wg0 -j ACCEPT") - #~(string-append #$(file-append iptables "/sbin/iptables") " -A WG1-FWD -i wg0 -o wg1 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT") + ;; ;; IPv4 Forwarding Chain + ;; #~(string-append #$(file-append iptables "/sbin/iptables") " -I FORWARD 1 -j WG1-FWD") + ;; #~(string-append #$(file-append iptables "/sbin/iptables") " -A WG1-FWD -i wg1 -o wg1 -j ACCEPT") + ;; #~(string-append #$(file-append iptables "/sbin/iptables") " -A WG1-FWD -i wg1 -o wg0 -j ACCEPT") + ;; #~(string-append #$(file-append iptables "/sbin/iptables") " -A WG1-FWD -i wg0 -o wg1 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT") - ;; IPv6 Forwarding Chain - #~(string-append #$(file-append iptables "/sbin/ip6tables") " -N WG1-FWD") - #~(string-append #$(file-append iptables "/sbin/ip6tables") " -I FORWARD 1 -j WG1-FWD") - #~(string-append #$(file-append iptables "/sbin/ip6tables") " -A WG1-FWD -i wg1 -o wg1 -j ACCEPT") - #~(string-append #$(file-append iptables "/sbin/ip6tables") " -A WG1-FWD -i wg1 -o wg0 -j ACCEPT") - #~(string-append #$(file-append iptables "/sbin/ip6tables") " -A WG1-FWD -i wg0 -o wg1 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT"))) - (pre-down - ;; IPv4 and IPv6 NAT - (list #~(string-append #$(file-append iptables "/sbin/iptables") " -t nat -D POSTROUTING -s 10.0.13.4/32 -o wg0 -j MASQUERADE") - #~(string-append #$(file-append iptables "/sbin/ip6tables") " -t nat -D POSTROUTING -s fd00:b0ba:cafe:babe::4/128 -o wg0 -j MASQUERADE") + ;; ;; IPv6 Forwarding Chain + ;; #~(string-append #$(file-append iptables "/sbin/ip6tables") " -N WG1-FWD") + ;; #~(string-append #$(file-append iptables "/sbin/ip6tables") " -I FORWARD 1 -j WG1-FWD") + ;; #~(string-append #$(file-append iptables "/sbin/ip6tables") " -A WG1-FWD -i wg1 -o wg1 -j ACCEPT") + ;; #~(string-append #$(file-append iptables "/sbin/ip6tables") " -A WG1-FWD -i wg1 -o wg0 -j ACCEPT") + ;; #~(string-append #$(file-append iptables "/sbin/ip6tables") " -A WG1-FWD -i wg0 -o wg1 -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT"))) + ;; (pre-down + ;; ;; IPv4 and IPv6 NAT + ;; (list #~(string-append #$(file-append iptables "/sbin/iptables") " -t nat -D POSTROUTING -s 10.0.13.4/32 -o wg0 -j MASQUERADE") + ;; #~(string-append #$(file-append iptables "/sbin/ip6tables") " -t nat -D POSTROUTING -s fd00:b0ba:cafe:babe::4/128 -o wg0 -j MASQUERADE") - ;; IPv4 Forwarding Chain - #~(string-append #$(file-append iptables "/sbin/iptables") " -D FORWARD -j WG1-FWD") - #~(string-append #$(file-append iptables "/sbin/iptables") " -F WG1-FWD") - #~(string-append #$(file-append iptables "/sbin/iptables") " -X WG1-FWD") + ;; ;; IPv4 Forwarding Chain + ;; #~(string-append #$(file-append iptables "/sbin/iptables") " -D FORWARD -j WG1-FWD") + ;; #~(string-append #$(file-append iptables "/sbin/iptables") " -F WG1-FWD") + ;; #~(string-append #$(file-append iptables "/sbin/iptables") " -X WG1-FWD") - ;; IPv6 Forwarding Chain - #~(string-append #$(file-append iptables "/sbin/ip6tables") " -D FORWARD -j WG1-FWD") - #~(string-append #$(file-append iptables "/sbin/ip6tables") " -F WG1-FWD") - #~(string-append #$(file-append iptables "/sbin/ip6tables") " -X WG1-FWD"))) - (peers - (list - (wireguard-peer - (name "saklas.epistemia") - (public-key "XvRailvccuc7LJIF4aaYM/MLkU4upiprwFlCfBllhl0=") - (allowed-ips '("10.0.13.1/32")) - (endpoint "141.95.52.111:51820") - (keep-alive 25)) - (wireguard-peer - (name "hastur.epistemia") - (public-key "vzx5EmZgJ1vTYgCbNOgWgDrI6YmvP8xV8s6zzijOnCg=") - (allowed-ips '("10.0.13.3/32")) - (keep-alive 25)) - (wireguard-peer - (name "pixel.epistemia") - (public-key "qj9S6SNMIldqrX2syhZ5+tGIRPgiCsMPRrS4h2/4cSA=") - (allowed-ips '("10.0.13.4/32")) - (keep-alive 25)))))) - (simple-service 'wireguard-route-timer - shepherd-root-service-type - (list (shepherd-timer - '(wg1-route-updater) - "* * * * *" - #~("/data_hdd/wireguard-endpoint-route") - #:requirement '(wireguard-wg1) - #:documentation "Update Wireguard routes every minute."))) - (service nginx-service-type - (nginx-configuration - (server-blocks - (list - (nginx-reverse-proxy "llm.demiurge.epistemia" 8080) - (nginx-reverse-proxy "sdui.demiurge.epistemia" 5000))))) - (service pam-limits-service-type - (list (pam-limits-entry "@audio" 'both 'rtprio 99) - (pam-limits-entry "@audio" 'both 'memlock 'unlimited))) - llm-router-service - ;; needed by guix packages fetched over ssh (e.g. emacs-kasi) - (extra-special-file "/etc/ssh/ssh_known_hosts" - (plain-file "ssh_known_hosts" - "vineetk.net ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMcHRzXCGVZc0FnC986styK07XLLv0ILGeOzQMrWEXjy\n"))) - %base-services) - (sysctl-service-type config => - (sysctl-configuration - (settings - (append - '(("net.ipv4.ip_forward" . "1") - ("net.ipv6.conf.all.forwarding" . "1") - ;; for nginx since shepherd-requirement cannot be set - ("net.ipv4.ip_nonlocal_bind" . "1") - ("net.ipv6.ip_nonlocal_bind" . "1")) - %default-sysctl-settings))))))) + ;; ;; IPv6 Forwarding Chain + ;; #~(string-append #$(file-append iptables "/sbin/ip6tables") " -D FORWARD -j WG1-FWD") + ;; #~(string-append #$(file-append iptables "/sbin/ip6tables") " -F WG1-FWD") + ;; #~(string-append #$(file-append iptables "/sbin/ip6tables") " -X WG1-FWD"))) + ;; (peers + ;; (list + ;; (wireguard-peer + ;; (name "saklas.epistemia") + ;; (public-key "XvRailvccuc7LJIF4aaYM/MLkU4upiprwFlCfBllhl0=") + ;; (allowed-ips '("10.0.13.1/32")) + ;; (endpoint "141.95.52.111:51820") + ;; (keep-alive 25)) + ;; (wireguard-peer + ;; (name "hastur.epistemia") + ;; (public-key "vzx5EmZgJ1vTYgCbNOgWgDrI6YmvP8xV8s6zzijOnCg=") + ;; (allowed-ips '("10.0.13.3/32")) + ;; (keep-alive 25)) + ;; (wireguard-peer + ;; (name "pixel.epistemia") + ;; (public-key "qj9S6SNMIldqrX2syhZ5+tGIRPgiCsMPRrS4h2/4cSA=") + ;; (allowed-ips '("10.0.13.4/32")) + ;; (keep-alive 25)))))) + ;; (simple-service 'wireguard-route-timer + ;; shepherd-root-service-type + ;; (list (shepherd-timer + ;; '(wg1-route-updater) + ;; "* * * * *" + ;; #~("/data_hdd/wireguard-endpoint-route") + ;; #:requirement '(wireguard-wg1) + ;; #:documentation "Update Wireguard routes every minute."))) + (service nginx-service-type + (nginx-configuration + (server-blocks + (list + (nginx-reverse-proxy "llm.demiurge.epistemia" 8080) + (nginx-reverse-proxy "sdui.demiurge.epistemia" 5000))))) + (service pam-limits-service-type + (list (pam-limits-entry "@audio" 'both 'rtprio 99) + (pam-limits-entry "@audio" 'both 'memlock 'unlimited))) + llm-router-service sdui-service + ;; needed by guix packages fetched over ssh (e.g. emacs-kasi) + (extra-special-file "/etc/ssh/ssh_known_hosts" + (plain-file "ssh_known_hosts" + "vineetk.net ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMcHRzXCGVZc0FnC986styK07XLLv0ILGeOzQMrWEXjy\n"))) + %base-services) + (sysctl-service-type config => + (sysctl-configuration + (settings + (append + '(("net.ipv4.ip_forward" . "1") + ("net.ipv6.conf.all.forwarding" . "1") + ;; for nginx since shepherd-requirement cannot be set + ("net.ipv4.ip_nonlocal_bind" . "1") + ("net.ipv6.ip_nonlocal_bind" . "1")) + %default-sysctl-settings)))))))