system.scm
b6763bb47a50ce887513f797a0061e374a210ced
· 8.6 KB · 206 lines
raw
| 1 | ;; This is an operating system configuration generated |
| 2 | ;; by the graphical installer. |
| 3 | ;; |
| 4 | ;; Once installation is complete, you can learn and modify |
| 5 | ;; this file to tweak the system configuration, and pass it |
| 6 | ;; to the 'guix system reconfigure' command to effect your |
| 7 | ;; changes. |
| 8 | |
| 9 | |
| 10 | ;; Indicate which modules to import to access the variables |
| 11 | ;; used in this configuration. |
| 12 | (use-modules (gnu) (nongnu packages linux)) |
| 13 | (use-modules (gnu system setuid)) |
| 14 | (use-modules (gnu packages admin)) |
| 15 | (use-modules (guix packages)) |
| 16 | (use-modules (gnu packages shells)) |
| 17 | (use-modules (guix build-system trivial)) |
| 18 | (use-modules (guix licenses)) |
| 19 | (use-modules (gnu packages tls)) |
| 20 | (use-modules (srfi srfi-1)) |
| 21 | (use-package-modules security-token) |
| 22 | (use-service-modules cups desktop networking xorg ssh sound security-token docker) |
| 23 | |
| 24 | ; Define package that installs my root ca public keys |
| 25 | (define my-ca-certs |
| 26 | (package |
| 27 | (name "my-ca-certs") |
| 28 | (version "1") |
| 29 | (source (local-file "./CACerts" |
| 30 | #:recursive? #t)) |
| 31 | (build-system trivial-build-system) |
| 32 | (license mpl2.0) |
| 33 | (home-page "https://rschanz.org") |
| 34 | (arguments |
| 35 | `(#:modules |
| 36 | ((guix build utils)) |
| 37 | #:builder |
| 38 | (begin |
| 39 | (use-modules (guix build utils) |
| 40 | (srfi srfi-1) |
| 41 | (srfi srfi-26) |
| 42 | (ice-9 ftw)) |
| 43 | (let* ((ca-certificates (assoc-ref %build-inputs "source")) |
| 44 | (crt-suffix ".crt") |
| 45 | (is-certificate? (cut string-suffix? crt-suffix <>)) |
| 46 | (certificates (filter is-certificate? |
| 47 | (scandir ca-certificates))) |
| 48 | (out (assoc-ref %outputs "out")) |
| 49 | (certificate-directory (string-append out "/etc/ssl/certs")) |
| 50 | (openssl (string-append (assoc-ref %build-inputs "openssl") "/bin/openssl"))) |
| 51 | (mkdir-p certificate-directory) |
| 52 | (for-each |
| 53 | (lambda (cert) |
| 54 | (invoke |
| 55 | openssl "x509" |
| 56 | "-in" (string-append ca-certificates "/" cert) |
| 57 | "-outform" "PEM" |
| 58 | "-out" (string-append certificate-directory "/" cert ".pem"))) |
| 59 | certificates) |
| 60 | #t)))) |
| 61 | (native-inputs |
| 62 | (list openssl)) |
| 63 | (synopsis "My CA Certs") |
| 64 | (description synopsis))) |
| 65 | |
| 66 | ; Re-define the base packages to remove sudo |
| 67 | (define %my-base-packages |
| 68 | (remove (lambda (package) |
| 69 | (member (package-name package) |
| 70 | (list "sudo" "nano"))) |
| 71 | %base-packages )) |
| 72 | |
| 73 | (define %backlight-udev-rule |
| 74 | (udev-rule |
| 75 | "90-backlight.rules" |
| 76 | (string-append "ACTION==\"add\", SUBSYSTEM==\"backlight\", " |
| 77 | "RUN+=\"/run/current-system/profile/bin/chgrp video /sys/class/backlight/%k/brightness\"" |
| 78 | "\n" |
| 79 | "ACTION==\"add\", SUBSYSTEM==\"backlight\", " |
| 80 | "RUN+=\"/run/current-system/profile/bin/chmod g+w /sys/class/backlight/%k/brightness\""))) |
| 81 | |
| 82 | (operating-system |
| 83 | (kernel linux) |
| 84 | (firmware (list linux-firmware)) |
| 85 | (locale "en_US.utf8") |
| 86 | (timezone "America/New_York") |
| 87 | (keyboard-layout (keyboard-layout "us")) |
| 88 | (host-name "RyanThinkpad") |
| 89 | |
| 90 | ;; The list of user accounts ('root' is implicit). |
| 91 | (users (cons* (user-account |
| 92 | (name "ryan") |
| 93 | (comment "Ryan") |
| 94 | (group "users") |
| 95 | ;(shell (file-append zsh "/bin/zsh")) |
| 96 | (home-directory "/home/ryan") |
| 97 | (supplementary-groups '("wheel" "netdev" "audio" "video" "lp" "plugdev" "docker"))) |
| 98 | %base-user-accounts)) |
| 99 | |
| 100 | ;; Packages installed system-wide. Users can also install packages |
| 101 | ;; under their own account: use 'guix search KEYWORD' to search |
| 102 | ;; for packages and 'guix install PACKAGE' to install a package. |
| 103 | (packages (append (map specification->package (list "sway" |
| 104 | "swaybg" |
| 105 | "swayidle" |
| 106 | "swaylock-effects" |
| 107 | "fuzzel" |
| 108 | "alacritty" |
| 109 | "pinentry-qt" |
| 110 | "adwaita-icon-theme" |
| 111 | "hicolor-icon-theme" |
| 112 | "git" |
| 113 | "nss-certs" |
| 114 | "waybar" |
| 115 | "gnupg" |
| 116 | "light" |
| 117 | "mako" |
| 118 | "grim" |
| 119 | "slurp" |
| 120 | "wl-clipboard" |
| 121 | "bluez" |
| 122 | "blueman" |
| 123 | "opendoas" |
| 124 | "xdg-desktop-portal-wlr" |
| 125 | "xdg-desktop-portal" |
| 126 | "pipewire" |
| 127 | "docker" |
| 128 | "wireplumber" |
| 129 | "zsh")) |
| 130 | (list my-ca-certs) |
| 131 | %my-base-packages )) |
| 132 | |
| 133 | ;; Below is the list of system services. To search for available |
| 134 | ;; services, run 'guix system search KEYWORD' in a terminal. |
| 135 | (services |
| 136 | (append (list |
| 137 | |
| 138 | ;; To configure OpenSSH, pass an 'openssh-configuration' |
| 139 | ;; record as a second argument to 'service' below. |
| 140 | (service openssh-service-type) |
| 141 | (service pcscd-service-type) |
| 142 | (service docker-service-type) |
| 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 | (setuid-programs |
| 172 | (append (list (file-like->setuid-program |
| 173 | (file-append |
| 174 | (specification->package "swaylock-effects") |
| 175 | "/bin/swaylock")) |
| 176 | (file-like->setuid-program |
| 177 | (file-append |
| 178 | (specification->package "opendoas") |
| 179 | "/bin/doas"))) |
| 180 | (delete sudo %setuid-programs))) |
| 181 | (bootloader (bootloader-configuration |
| 182 | (bootloader grub-efi-bootloader) |
| 183 | (targets (list "/boot/efi")) |
| 184 | (keyboard-layout keyboard-layout))) |
| 185 | (mapped-devices (list (mapped-device |
| 186 | (source (uuid |
| 187 | "adcaf322-7ee5-48ec-abf6-4a9b10643878")) |
| 188 | (target "sysroot") |
| 189 | (type luks-device-mapping)))) |
| 190 | |
| 191 | ;; The list of file systems that get "mounted". The unique |
| 192 | ;; file system identifiers there ("UUIDs") can be obtained |
| 193 | ;; by running 'blkid' in a terminal. |
| 194 | (file-systems (cons* (file-system |
| 195 | (mount-point "/") |
| 196 | (device "/dev/mapper/sysroot") |
| 197 | (type "ext4") |
| 198 | (dependencies mapped-devices)) |
| 199 | (file-system |
| 200 | (mount-point "/boot/efi") |
| 201 | (device (uuid "DFE8-32EF" |
| 202 | 'fat32)) |
| 203 | (type "vfat")) %base-file-systems)) |
| 204 | (swap-devices |
| 205 | (list |
| 206 | (swap-space (target (uuid "7e1bb7c5-da2a-4509-8263-f707fc752993"))) ))) |