system.scm

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