system.scm

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