system.scm

232a9f91d237df4741078e2cf2322e49fb1ddf06 · 8.6 KB · 207 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 (delete alsa-service-type) )))
172 (setuid-programs
173 (append (list (file-like->setuid-program
174 (file-append
175 (specification->package "swaylock-effects")
176 "/bin/swaylock"))
177 (file-like->setuid-program
178 (file-append
179 (specification->package "opendoas")
180 "/bin/doas")))
181 (delete sudo %setuid-programs)))
182 (bootloader (bootloader-configuration
183 (bootloader grub-efi-bootloader)
184 (targets (list "/boot/efi"))
185 (keyboard-layout keyboard-layout)))
186 (mapped-devices (list (mapped-device
187 (source (uuid
188 "adcaf322-7ee5-48ec-abf6-4a9b10643878"))
189 (target "sysroot")
190 (type luks-device-mapping))))
191
192 ;; The list of file systems that get "mounted". The unique
193 ;; file system identifiers there ("UUIDs") can be obtained
194 ;; by running 'blkid' in a terminal.
195 (file-systems (cons* (file-system
196 (mount-point "/")
197 (device "/dev/mapper/sysroot")
198 (type "ext4")
199 (dependencies mapped-devices))
200 (file-system
201 (mount-point "/boot/efi")
202 (device (uuid "DFE8-32EF"
203 'fat32))
204 (type "vfat")) %base-file-systems))
205 (swap-devices
206 (list
207 (swap-space (target (uuid "7e1bb7c5-da2a-4509-8263-f707fc752993"))) )))