modules/ryan-config/base-system.scm
04498cbd95e47ac4e0ec323fe1ef3d5fac485455
· 8.0 KB · 186 lines
raw
| 1 | (use-modules (gnu) (nongnu packages linux)) |
| 2 | (use-modules (gnu system setuid)) |
| 3 | (use-modules (gnu packages admin)) |
| 4 | (use-modules (guix packages)) |
| 5 | (use-modules (gnu packages shells)) |
| 6 | (use-modules (guix build-system trivial)) |
| 7 | (use-modules (guix licenses)) |
| 8 | (use-modules (gnu packages tls)) |
| 9 | (use-modules (srfi srfi-1)) |
| 10 | (use-modules (ryan-packages freedesktop)) |
| 11 | (use-modules (ryan-packages wm)) |
| 12 | (use-package-modules security-token) |
| 13 | (use-service-modules cups desktop networking xorg ssh nix sound security-token docker virtualization) |
| 14 | |
| 15 | ; Define package that installs my root ca public keys |
| 16 | (define my-ca-certs |
| 17 | (package |
| 18 | (name "my-ca-certs") |
| 19 | (version "1") |
| 20 | (source (local-file "./CACerts" |
| 21 | #:recursive? #t)) |
| 22 | (build-system trivial-build-system) |
| 23 | (license mpl2.0) |
| 24 | (home-page "https://rschanz.org") |
| 25 | (arguments |
| 26 | `(#:modules |
| 27 | ((guix build utils)) |
| 28 | #:builder |
| 29 | (begin |
| 30 | (use-modules (guix build utils) |
| 31 | (srfi srfi-1) |
| 32 | (srfi srfi-26) |
| 33 | (ice-9 ftw)) |
| 34 | (let* ((ca-certificates (assoc-ref %build-inputs "source")) |
| 35 | (crt-suffix ".crt") |
| 36 | (is-certificate? (cut string-suffix? crt-suffix <>)) |
| 37 | (certificates (filter is-certificate? |
| 38 | (scandir ca-certificates))) |
| 39 | (out (assoc-ref %outputs "out")) |
| 40 | (certificate-directory (string-append out "/etc/ssl/certs")) |
| 41 | (openssl (string-append (assoc-ref %build-inputs "openssl") "/bin/openssl"))) |
| 42 | (mkdir-p certificate-directory) |
| 43 | (for-each |
| 44 | (lambda (cert) |
| 45 | (invoke |
| 46 | openssl "x509" |
| 47 | "-in" (string-append ca-certificates "/" cert) |
| 48 | "-outform" "PEM" |
| 49 | "-out" (string-append certificate-directory "/" cert ".pem"))) |
| 50 | certificates) |
| 51 | #t)))) |
| 52 | (native-inputs |
| 53 | (list openssl)) |
| 54 | (synopsis "My CA Certs") |
| 55 | (description synopsis))) |
| 56 | |
| 57 | ; Re-define the base packages to remove sudo |
| 58 | (define %my-base-packages |
| 59 | (remove (lambda (package) |
| 60 | (member (package-name package) |
| 61 | (list "sudo" "nano"))) |
| 62 | %base-packages )) |
| 63 | |
| 64 | (define %backlight-udev-rule |
| 65 | (udev-rule |
| 66 | "90-backlight.rules" |
| 67 | (string-append "ACTION==\"add\", SUBSYSTEM==\"backlight\", " |
| 68 | "RUN+=\"/run/current-system/profile/bin/chgrp video /sys/class/backlight/%k/brightness\"" |
| 69 | "\n" |
| 70 | "ACTION==\"add\", SUBSYSTEM==\"backlight\", " |
| 71 | "RUN+=\"/run/current-system/profile/bin/chmod g+w /sys/class/backlight/%k/brightness\""))) |
| 72 | |
| 73 | (operating-system |
| 74 | (kernel linux) |
| 75 | (firmware (list linux-firmware)) |
| 76 | (locale "en_US.utf8") |
| 77 | (timezone "America/New_York") |
| 78 | (keyboard-layout (keyboard-layout "us")) |
| 79 | (host-name "ThisWillChange") |
| 80 | |
| 81 | ;; The list of user accounts ('root' is implicit). |
| 82 | (users (cons* (user-account |
| 83 | (name "ryan") |
| 84 | (comment "Ryan") |
| 85 | (group "users") |
| 86 | ;(shell (file-append zsh "/bin/zsh")) |
| 87 | (home-directory "/home/ryan") |
| 88 | (supplementary-groups '("wheel" "netdev" "audio" "video" "lp" "plugdev" "docker" "libvirt" "kvm"))) |
| 89 | %base-user-accounts)) |
| 90 | |
| 91 | ;; Packages installed system-wide. Users can also install packages |
| 92 | ;; under their own account: use 'guix search KEYWORD' to search |
| 93 | ;; for packages and 'guix install PACKAGE' to install a package. |
| 94 | (packages (append (map specification->package (list "sway" |
| 95 | "swaybg" |
| 96 | "swayidle" |
| 97 | ;"swaylock-effects" |
| 98 | "fuzzel" |
| 99 | "alacritty" |
| 100 | "pinentry-qt" |
| 101 | "adwaita-icon-theme" |
| 102 | "hicolor-icon-theme" |
| 103 | "git" |
| 104 | "nss-certs" |
| 105 | "waybar" |
| 106 | "gnupg" |
| 107 | "light" |
| 108 | "mako" |
| 109 | "grim" |
| 110 | "slurp" |
| 111 | "wl-clipboard" |
| 112 | "bluez" |
| 113 | "blueman" |
| 114 | "ldacbt" |
| 115 | "libfreeaptx" |
| 116 | "libfdk" |
| 117 | "opendoas" |
| 118 | ;"xdg-desktop-portal-wlr" |
| 119 | "xdg-desktop-portal" |
| 120 | "pipewire" |
| 121 | "docker" |
| 122 | "libvirt" |
| 123 | "virt-manager" |
| 124 | "wireplumber" |
| 125 | "zsh")) |
| 126 | (list my-ca-certs xdg-desktop-portal-wlr-new swaylock-effects-new) |
| 127 | %my-base-packages )) |
| 128 | |
| 129 | ;; Below is the list of system services. To search for available |
| 130 | ;; services, run 'guix system search KEYWORD' in a terminal. |
| 131 | (services |
| 132 | (append (list |
| 133 | |
| 134 | ;; To configure OpenSSH, pass an 'openssh-configuration' |
| 135 | ;; record as a second argument to 'service' below. |
| 136 | (service openssh-service-type) |
| 137 | (service pcscd-service-type) |
| 138 | (service docker-service-type) |
| 139 | (service nix-service-type) |
| 140 | (service libvirt-service-type |
| 141 | (libvirt-configuration |
| 142 | (unix-sock-group "libvirt"))) |
| 143 | (service bluetooth-service-type) |
| 144 | (udev-rules-service 'fido2 libfido2 #:groups '("plugdev"))) |
| 145 | |
| 146 | ;; This is the default list of services we |
| 147 | ;; are appending to. |
| 148 | (modify-services %desktop-services |
| 149 | (guix-service-type config => |
| 150 | (guix-configuration |
| 151 | (inherit config) |
| 152 | (substitute-urls |
| 153 | (append (list "https://substitutes.nonguix.org") |
| 154 | %default-substitute-urls)) |
| 155 | (authorized-keys |
| 156 | (cons* (plain-file "non-guix.pub" |
| 157 | "(public-key |
| 158 | (ecc |
| 159 | (curve Ed25519) |
| 160 | (q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#) |
| 161 | ) |
| 162 | )" ) %default-authorized-guix-keys)))) |
| 163 | (udev-service-type config => |
| 164 | (udev-configuration |
| 165 | (inherit config) |
| 166 | (rules (cons %backlight-udev-rule |
| 167 | (udev-configuration-rules config))))) |
| 168 | (delete pulseaudio-service-type) |
| 169 | (delete gdm-service-type) |
| 170 | (delete xorg-server-service-type) |
| 171 | (delete alsa-service-type) ))) |
| 172 | (setuid-programs |
| 173 | (append (list (file-like->setuid-program |
| 174 | (file-append |
| 175 | ;(specification->package "swaylock-effects") |
| 176 | swaylock-effects-new |
| 177 | "/bin/swaylock")) |
| 178 | (file-like->setuid-program |
| 179 | (file-append |
| 180 | (specification->package "opendoas") |
| 181 | "/bin/doas"))) |
| 182 | (delete sudo %setuid-programs))) |
| 183 | (bootloader (bootloader-configuration |
| 184 | (bootloader grub-efi-bootloader) |
| 185 | (targets (list "/boot/efi")) |
| 186 | (keyboard-layout keyboard-layout)))))))) |