-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathos-main.scm
262 lines (235 loc) · 9.09 KB
/
os-main.scm
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
(use-modules
(srfi srfi-1)
(gnu)
(gnu system locale)
(gnu services networking)
(gnu services dbus)
(gnu services desktop)
(gnu services ssh)
(gnu packages base) ; for 'canonical-package'
(al places)
(al files)
(al utils)
(al guix packages)
(al guix services linux)
(al guix utils))
(define %user-name "al")
(define %group-name "users")
(define %host-name "leviafan")
(define %extra-linux-modules
'("fuse" ; for sshfs
"nbd" ; to mount qcow2 images
"sata_nv" ; for my HDD to be recognized
"snd-seq" ; for MIDI-keyboard
))
(define %redundant-linux-modules
'("pcspkr" "snd_pcsp"))
(define %redundant-packages
'("info-reader"
"iw"
"nano"
"net-tools"
"wireless-tools"
"zile"))
(define fake-installer
#~(lambda _ #t))
(define* (fake-configuration-file #:rest _)
(define builder
#~(call-with-output-file #$output
(lambda (port)
(format port "# This file is generated by my 'os-main.scm'."))))
(computed-file "fake.cfg" builder
#:options '(#:local-build? #t
#:substitutable? #f)))
(define os
(operating-system
;; (locale-libcs
;; (cons (guix-package base glibc-2.23)
;; %default-locale-libcs))
(host-name %host-name)
(timezone "Europe/Moscow")
(locale "en_US.utf8")
(locale-definitions
(list (locale-definition (source "en_US")
(name "en_US.utf8"))
(locale-definition (source "de_DE")
(name "de_DE.utf8"))
(locale-definition (source "ru_RU")
(name "ru_RU.utf8"))))
(bootloader
;; Since I always use "guix system build --no-bootloader", I don't
;; want to build grub, its configuration file, etc. but guix wants
;; to do it anyway (it is done by 'perform-action' procedure in
;; (guix scripts system) module). So here, I insist on avoiding
;; any bootloader.
(bootloader-configuration
(bootloader (bootloader
(name 'fake-bootloader)
(package (my-package misc empty-package))
(installer fake-installer)
(disk-image-installer fake-installer)
(configuration-file "fake")
(configuration-file-generator fake-configuration-file)))
(target "/dev/sda")))
(kernel-arguments
(list (string-append "modprobe.blacklist="
(apply comma-separated
%redundant-linux-modules))))
(initrd-modules (append %extra-linux-modules %base-initrd-modules))
(file-systems
(cons* (file-system
(device (file-system-label "guix"))
(type "ext4")
(mount-point "/"))
(file-system
(device (file-system-label "storage"))
(type "ext4")
(mount-point "/mnt/storage")
(create-mount-point? #t)
(check? #f))
(file-system
(device (file-system-label "arch"))
(type "ext4")
(mount-point "/mnt/arch")
(create-mount-point? #t)
(check? #f))
(file-system
(device (file-system-label "boot"))
(type "ext4")
(mount-point "/mnt/boot")
(create-mount-point? #t)
(check? #f))
(file-system
(device "/dev/sr0")
(type "iso9660")
(mount-point "/mnt/cdrom")
(mount? #f)
(create-mount-point? #t)
(check? #f)
(options (comma-separated "ro" "user" "noauto")))
(file-system
(device (file-system-label "teXet"))
(type "vfat")
(mount-point "/mnt/texet")
(mount? #f)
(create-mount-point? #t)
(check? #f)
(options (comma-separated
"rw" "user" "noauto" "utf8" "umask=0002"
(string-append "gid=" %group-name))))
%base-file-systems))
(users
(cons* (user-account
(name %user-name)
(uid 1000)
(comment "Alex Kost")
(home-directory (string-append "/home/" %user-name))
(group %group-name)
(supplementary-groups
;; "input" and "tty" are needed to start X server without
;; root permissions: "input" - to access "/dev/input"
;; devices, "tty" - to access "/dev/ttyN".
'("wheel" "kvm" "audio" "video" "input" "tty" "lp" "cdrom")))
%base-user-accounts))
(groups
;; Use ID 100 for "users" group. Actually, this wouldn't change ID
;; of an existing group, because the following command (called by
;; 'add-group' in (gnu build activation) module):
;;
;; groupadd -g 100 --system users
;;
;; fails telling: "group 'users' already exists".
(replace (lambda (group)
(string=? "users" (user-group-name group)))
(user-group (name "users")
(id 100)
(system? #t))
%base-groups))
(sudoers-file (local-file (config-file "etc/sudoers")))
(hosts-file (local-file (config-file "etc/hosts")))
(issue "Guix is Great! Ave Guix!! Ave!!!\n\n")
(packages
(append (specifications->packages
"nss-certs" "iptables")
(my-packages
(misc suspend))
xorg-packages
(remove-packages %redundant-packages
%base-packages)))
(services
(list
(service virtual-terminal-service-type)
(service console-font-service-type
(map (lambda (tty)
(cons tty %default-console-font))
'("tty1" "tty2" "tty3" "tty4" "tty5" "tty6")))
(service agetty-service-type
(agetty-configuration
(extra-options '("-L"))
(term "vt100")
(tty #f)))
(service mingetty-service-type
(mingetty-configuration (tty "tty1")
(auto-login %user-name)))
(service mingetty-service-type
(mingetty-configuration (tty "tty2")))
(service mingetty-service-type
(mingetty-configuration (tty "tty3")))
(service mingetty-service-type
(mingetty-configuration (tty "tty4")))
(service mingetty-service-type
(mingetty-configuration (tty "tty5")))
(service mingetty-service-type
(mingetty-configuration (tty "tty6")))
(service login-service-type
(login-configuration
(motd (plain-file "motd" "\
Welcome to Hyksos! I mean GuixOS!\n\n"))))
(service loadkeys-service-type
(local-file (config-file "kbd/dvorak-alt.map")))
(service keycodes-from-file-service-type
(local-file (config-file "kbd/scancodes-msmult")))
(service tor-service-type)
(service dhcp-client-service-type)
(service static-networking-service-type
(list ;; (static-networking (interface "enp0s7")
;; (ip "192.168.1.32")
;; (gateway "192.168.1.1")
;; (name-servers '("77.88.8.8")))
(static-networking (interface "lo")
(ip "127.0.0.1")
(provision '(loopback)))))
(udisks-service)
(service polkit-service-type)
(service elogind-service-type
(elogind-configuration
(handle-suspend-key 'ignore)))
(dbus-service)
(service openssh-service-type (openssh-configuration))
(syslog-service (syslog-configuration
(config-file (local-file
(config-file "syslog/syslog.conf")))))
(service urandom-seed-service-type)
(service guix-service-type)
(service nscd-service-type)
(service udev-service-type
(udev-configuration
(rules (specifications->packages
"alsa-utils" "fuse"))))
(service special-files-service-type
;; Using 'canonical-package' as bash and coreutils
;; canonical packages are already a part of
;; '%base-packages'.
`(("/bin/sh"
,(file-append (canonical-package
(guix-package bash bash))
"/bin/bash"))
("/bin/bash"
,(file-append (canonical-package
(guix-package bash bash))
"/bin/bash"))
("/usr/bin/env"
,(file-append (canonical-package
(guix-package base coreutils))
"/bin/env"))))))))
os