blob: e2c9ef8481d17e9930fefb330f52378ed6efe252 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
|
#+TITLE: Guix Configuration file
* Resources
[[https://guix.gnu.org/manual/en/html_node/index.html][guix]]
[[https://github.com/daviwil/dotfiles/blob/master/Systems.org][daviwil/dotfiles]]
* Managing profiles
Source: [[https://github.com/daviwil/dotfiles/blob/master/Systems.org#profile-management][daviwil/dotfiles]]
** Activate profiles
#+begin_src sh :tangle bin/activate-profiles :shebang #!/bin/sh
# Source: https://github.com/daviwil/dotfiles/blob/master/Systems.org#profile-management
GREEN='\033[1;32m'
RED='\033[1;30m'
NC='\033[0m'
GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles
profiles=$*
if [[ $# -eq 0 ]]; then
profiles="$HOME/.config/guix/manifests/*.scm";
fi
for profile in $profiles; do
# Remove the path and file extension, if any
profileName=$(basename $profile)
profileName="${profileName%.*}"
profilePath="$GUIX_EXTRA_PROFILES/$profileName"
manifestPath=$HOME/.config/guix/manifests/$profileName.scm
if [ -f $manifestPath ]; then
echo
echo -e "${GREEN}Activating profile:" $manifestPath "${NC}"
echo
mkdir -p $profilePath
guix package --manifest=$manifestPath --profile="$profilePath/$profileName"
# Source the new profile
GUIX_PROFILE="$profilePath/$profileName"
if [ -f $GUIX_PROFILE/etc/profile ]; then
. "$GUIX_PROFILE"/etc/profile
else
echo -e "${RED}Couldn't find profile:" $GUIX_PROFILE/etc/profile "${NC}"
fi
else
echo "No profile found at path" $profilePath
fi
done
#+end_src
** Update profiles
#+begin_src sh :tangle bin/update-profiles :shebang #!/bin/sh
# Source: https://github.com/daviwil/dotfiles/blob/master/Systems.org#profile-management
GREEN='\033[1;32m'
NC='\033[0m'
GUIX_EXTRA_PROFILES=$HOME/.guix-extra-profiles
profiles=$*
if [[ $# -eq 0 ]]; then
profiles="$GUIX_EXTRA_PROFILES/*";
fi
for profile in $profiles; do
profileName=$(basename $profile)
profilePath=$GUIX_EXTRA_PROFILES/$profileName
echo
echo -e "${GREEN}Updating profile:" $profilePath "${NC}"
echo
guix package --profile="$profilePath/$profileName" --manifest="$HOME/.config/guix/manifests/$profileName.scm"
done
#+end_src
* Channels
#+begin_src scheme :tangle .config/guix/channels.scm
(list
(channel
(name 'guix)
(url "https://git.savannah.gnu.org/git/guix.git")
;; (url "file:///home/daviwil/Projects/Code/guix"))
(introduction
(make-channel-introduction
"9edb3f66fd807b096b48283debdcddccfea34bad"
(openpgp-fingerprint
"BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA"))))
(channel
(name 'nonguix)
(url "https://gitlab.com/nonguix/nonguix")
;; Enable signature verification:
(introduction
(make-channel-introduction
"897c1a470da759236cc11798f4e0a5f7d4d59fbc"
(openpgp-fingerprint
"2A39 3FFF 68F4 EF7A 3D29 12AF 6F51 20A0 22FB B2D5")))))
#+end_src
* Systems
** Base
#+begin_src scheme :tangle .config/guix/systems/base-system.scm
(define-module (base-system)
#:use-module (gnu)
#:use-module (gnu services pm)
#:use-module (gnu services docker)
#:use-module (gnu services networking)
#:use-module (gnu services virtualization) ; todo make
#:use-module (gnu packages vim)
#:use-module (gnu services desktop)
#:use-module (gnu packages xorg)
#:use-module (gnu packages emacs)
#:use-module (gnu packages file-systems)
#:use-module (gnu packages linux)
#:use-module (gnu packages audio)
#:use-module (gnu packages pulseaudio)
#:use-module (gnu packages version-control)
#:use-module (gnu packages package-management))
; #:use-module (nongnu packages linux)
; #:use-module (nongnu system linux-initrd))
(use-service-modules ssh)
(use-package-modules certs)
(use-service-modules desktop xorg)
#+end_src
*Packages*
#+begin_src scheme :noweb-ref packages :noweb yes
;; Packages
(packages (append (list
git
exfat-utils
fuse-exfat
stow
vim
emacs
bluez
bluez-alsa
pulseaudio
tlp
ncurses
xf86-input-libinput
nss-certs) ;; For https connection
%base-packages))
#+end_src
*Services*
#+begin_src scheme :noweb-ref services :noweb yes
;; Services
(services
(append
(list
(service elogind-service-type)
(service openssh-service-type)
(service network-manager-service-type)
(service slim-service-type)
(service tlp-service-type
(tlp-configuration
(cpu-boost-on-ac? #t)
(wifi-pwr-on-bat? #t)))
(bluetooth-service #:auto-enable? #t)
(service docker-service-type)
(service wpa-supplicant-service-type))
(service libvirt-service-type
(libvirt-configuration
(unix-sock-group "libvirt")
(tls-port "16555")))
(set-xorg-configuration
(xorg-configuration
(keyboard-layout keyboard-layout)))
%base-services))
#+end_src
*Users Accounts*
#+begin_src scheme :noweb-ref users :noweb yes
;; Users
(users (cons (user-account
(name "jakub")
(comment "Jakub Dlugosz")
(group "users")
(home-directory "/home/jakub")
(supplementary-groups '(
"wheel"
"netdev"
"kvm"
"tty"
"input"
"docker"
"lp"
"audio"
"video")))
%base-user-accounts))
#+end_src
*Base operating system*
#+begin_src scheme :tangle .config/guix/systems/base-system.scm :noweb yes
(define-public base-operating-system
(operating-system
(host-name "base")
(timezone "Europe/Warsaw")
(locale "en_US.utf8")
(keyboard-layout (keyboard-layout "pl"))
;; Use non-free Linux and firmware
;; (kernel linux)
;; (firmware (list linux-firmware))
;; (initrd microcode-initrd)
(bootloader (bootloader-configuration
(bootloader grub-efi-bootloader)
(targets "/boot/efi")))
;; (keyboard-layout keyboard-layout)))
;; Guix doesn't like it when there isn't a file-systems
;; entry, so add one that is meant to be overridden
(file-systems (cons*
(file-system
(mount-point "/tmp")
(device "none")
(type "tmpfs")
(check? #f))
%base-file-systems))
<<users>>
<<packages>>
<<services>>
;; Allow resolution of '.local' host names with mDNS
(name-service-switch %mdns-host-lookup-nss)))
#+end_src
** Systems
*** Viking
#+begin_src scheme :tangle .config/guix/systems/viking.scm
(define-module (viking)
#:use-module (base-system)
#:use-module (gnu))
(operating-system
(inherit base-operating-system)
(host-name "viking")
(bootloader
(bootloader-configuration
(bootloader grub-bootloader)
(target "/dev/sda")))
(mapped-devices
(list (mapped-device
(source
(uuid "75a1ebd7-13c2-442f-80ff-1b5e59522e29"))
(target "cryptroot")
(type luks-device-mapping))))
(file-systems
(cons* (file-system
(mount-point "/")
(device "/dev/mapper/cryptroot")
(type "ext4")
(dependencies mapped-devices))
%base-file-systems)))
#+end_src
|