system.scm

9a856d3a5b1f2571a0b575b7476cfae6f0ca9437 · 9.2 KB · 217 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-modules (ryan-packages freedesktop))
22 (use-package-modules security-token)
23 (use-service-modules cups desktop networking xorg ssh nix sound security-token docker virtualization)
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" "libvirt" "kvm")))
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 "ldacbt"
125 "libfreeaptx"
126 "libfdk"
127 "opendoas"
128 ;"xdg-desktop-portal-wlr"
129 "xdg-desktop-portal"
130 "pipewire"
131 "docker"
132 "libvirt"
133 "virt-manager"
134 "wireplumber"
135 "zsh"))
136 (list my-ca-certs xdg-desktop-portal-wlr-new)
137 %my-base-packages ))
138
139 ;; Below is the list of system services. To search for available
140 ;; services, run 'guix system search KEYWORD' in a terminal.
141 (services
142 (append (list
143
144 ;; To configure OpenSSH, pass an 'openssh-configuration'
145 ;; record as a second argument to 'service' below.
146 (service openssh-service-type)
147 (service pcscd-service-type)
148 (service docker-service-type)
149 (service nix-service-type)
150 (service libvirt-service-type
151 (libvirt-configuration
152 (unix-sock-group "libvirt")))
153 (service bluetooth-service-type)
154 (udev-rules-service 'fido2 libfido2 #:groups '("plugdev")))
155
156 ;; This is the default list of services we
157 ;; are appending to.
158 (modify-services %desktop-services
159 (guix-service-type config =>
160 (guix-configuration
161 (inherit config)
162 (substitute-urls
163 (append (list "https://substitutes.nonguix.org")
164 %default-substitute-urls))
165 (authorized-keys
166 (cons* (plain-file "non-guix.pub"
167 "(public-key
168 (ecc
169 (curve Ed25519)
170 (q #C1FD53E5D4CE971933EC50C9F307AE2171A2D3B52C804642A7A35F84F3A4EA98#)
171 )
172 )" ) %default-authorized-guix-keys))))
173 (udev-service-type config =>
174 (udev-configuration
175 (inherit config)
176 (rules (cons %backlight-udev-rule
177 (udev-configuration-rules config)))))
178 (delete pulseaudio-service-type)
179 (delete gdm-service-type)
180 (delete xorg-server-service-type)
181 (delete alsa-service-type) )))
182 (setuid-programs
183 (append (list (file-like->setuid-program
184 (file-append
185 (specification->package "swaylock-effects")
186 "/bin/swaylock"))
187 (file-like->setuid-program
188 (file-append
189 (specification->package "opendoas")
190 "/bin/doas")))
191 (delete sudo %setuid-programs)))
192 (bootloader (bootloader-configuration
193 (bootloader grub-efi-bootloader)
194 (targets (list "/boot/efi"))
195 (keyboard-layout keyboard-layout)))
196 (mapped-devices (list (mapped-device
197 (source (uuid
198 "adcaf322-7ee5-48ec-abf6-4a9b10643878"))
199 (target "sysroot")
200 (type luks-device-mapping))))
201
202 ;; The list of file systems that get "mounted". The unique
203 ;; file system identifiers there ("UUIDs") can be obtained
204 ;; by running 'blkid' in a terminal.
205 (file-systems (cons* (file-system
206 (mount-point "/")
207 (device "/dev/mapper/sysroot")
208 (type "ext4")
209 (dependencies mapped-devices))
210 (file-system
211 (mount-point "/boot/efi")
212 (device (uuid "DFE8-32EF"
213 'fat32))
214 (type "vfat")) %base-file-systems))
215 (swap-devices
216 (list
217 (swap-space (target (uuid "7e1bb7c5-da2a-4509-8263-f707fc752993"))) )))