gnu: Add ucd.
[jackhill/guix/guix.git] / gnu / system.scm
CommitLineData
033adfe7 1;;; GNU Guix --- Functional package management for GNU
ae7a316b 2;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès <ludo@gnu.org>
5e738ac2 3;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
5dccaffe 4;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
1ef8b72a 5;;; Copyright © 2016 Chris Marusich <cmmarusich@gmail.com>
c76b3046 6;;; Copyright © 2017 Mathieu Othacehe <m.othacehe@gmail.com>
5144df2c 7;;; Copyright © 2019 Meiyo Peng <meiyo.peng@gmail.com>
033adfe7
LC
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24(define-module (gnu system)
bdc61ff9 25 #:use-module (guix inferior)
033adfe7
LC
26 #:use-module (guix store)
27 #:use-module (guix monads)
02100028 28 #:use-module (guix gexp)
033adfe7
LC
29 #:use-module (guix records)
30 #:use-module (guix packages)
31 #:use-module (guix derivations)
29fce8b6 32 #:use-module (guix profiles)
84765839 33 #:use-module (guix ui)
033adfe7
LC
34 #:use-module (gnu packages base)
35 #:use-module (gnu packages bash)
bdb36958 36 #:use-module (gnu packages guile)
01ac0e6b 37 #:use-module (gnu packages guile-xyz)
9de46ffb 38 #:use-module (gnu packages admin)
8a07c289 39 #:use-module (gnu packages linux)
a96a82d7 40 #:use-module (gnu packages pciutils)
033adfe7 41 #:use-module (gnu packages package-management)
6f436c54
LC
42 #:use-module (gnu packages less)
43 #:use-module (gnu packages zile)
55e70e65 44 #:use-module (gnu packages nano)
a68c6967 45 #:use-module (gnu packages gawk)
18316d86 46 #:use-module (gnu packages man)
939c5c31 47 #:use-module (gnu packages texinfo)
a68c6967 48 #:use-module (gnu packages compression)
f34c56be 49 #:use-module (gnu packages firmware)
db4fdc04 50 #:use-module (gnu services)
0190c1c0 51 #:use-module (gnu services shepherd)
db4fdc04 52 #:use-module (gnu services base)
b09a8da4 53 #:use-module (gnu bootloader)
033adfe7 54 #:use-module (gnu system shadow)
996ed739 55 #:use-module (gnu system nss)
598e19dc 56 #:use-module (gnu system locale)
6e828634 57 #:use-module (gnu system pam)
735c6dd7 58 #:use-module (gnu system linux-initrd)
9b336338 59 #:use-module (gnu system uuid)
c5df1839 60 #:use-module (gnu system file-systems)
060d62a7 61 #:use-module (gnu system mapped-devices)
033adfe7
LC
62 #:use-module (ice-9 match)
63 #:use-module (srfi srfi-1)
64 #:use-module (srfi srfi-26)
598e19dc
LC
65 #:use-module (srfi srfi-34)
66 #:use-module (srfi srfi-35)
3382bfe9 67 #:use-module (rnrs bytevectors)
033adfe7
LC
68 #:export (operating-system
69 operating-system?
d8bead6c 70 this-operating-system
d5b429ab
LC
71
72 operating-system-bootloader
033adfe7 73 operating-system-services
69cae3d3 74 operating-system-essential-services
f8885eca 75 operating-system-default-essential-services
217a5b85 76 operating-system-user-services
033adfe7 77 operating-system-packages
fd3bfc44 78 operating-system-host-name
c65e1834 79 operating-system-hosts-file
fd3bfc44 80 operating-system-kernel
44d5f54e 81 operating-system-kernel-file
33f0aa88 82 operating-system-kernel-arguments
3f03a198
LC
83 operating-system-label
84 operating-system-default-label
bc499b11 85 operating-system-initrd-modules
fd3bfc44
LC
86 operating-system-initrd
87 operating-system-users
88 operating-system-groups
548d4c13 89 operating-system-issue
fd3bfc44
LC
90 operating-system-timezone
91 operating-system-locale
598e19dc 92 operating-system-locale-definitions
34760ae7 93 operating-system-locale-libcs
5dae0186 94 operating-system-mapped-devices
83bcd0b8 95 operating-system-file-systems
6b779207 96 operating-system-store-file-system
2bdd7ac1
LC
97 operating-system-user-mapped-devices
98 operating-system-boot-mapped-devices
b25937e3 99 operating-system-activation-script
b2fef041
LC
100 operating-system-user-accounts
101 operating-system-shepherd-service-names
20abb8c4 102 operating-system-user-kernel-arguments
033adfe7 103
1aa0033b 104 operating-system-derivation
83bcd0b8 105 operating-system-profile
c76b3046 106 operating-system-bootcfg
239db054
DT
107 operating-system-etc-directory
108 operating-system-locale-directory
109 operating-system-boot-script
110
43fe431c 111 system-linux-image-file-name
9fcfe30d 112 operating-system-with-gc-roots
33b7cb7a 113 operating-system-with-provenance
43fe431c 114
b8300494
AK
115 boot-parameters
116 boot-parameters?
117 boot-parameters-label
118 boot-parameters-root-device
f96752e3 119 boot-parameters-bootloader-name
a28cfee8 120 boot-parameters-bootloader-menu-entries
1ef8b72a
CM
121 boot-parameters-store-device
122 boot-parameters-store-mount-point
b8300494
AK
123 boot-parameters-kernel
124 boot-parameters-kernel-arguments
d7b342d8 125 boot-parameters-initrd
4e4e0185 126 read-boot-parameters
9530e73b 127 read-boot-parameters-file
1975c754 128 boot-parameters->menu-entry
b8300494 129
568841d4 130 local-host-aliases
d0f3a672 131 %root-account
df5ce088 132 %setuid-programs
5dae0186 133 %base-packages
374f14c2 134 %base-firmware))
033adfe7
LC
135
136;;; Commentary:
137;;;
138;;; This module supports whole-system configuration.
139;;;
140;;; Code:
141
a7ef45d9
LC
142(define (bootable-kernel-arguments system root-device)
143 "Return a list of kernel arguments (gexps) to boot SYSTEM from ROOT-DEVICE."
144 (list (string-append "--root="
145 (cond ((uuid? root-device)
146
147 ;; Note: Always use the DCE format because that's
148 ;; what (gnu build linux-boot) expects for the
149 ;; '--root' kernel command-line option.
150 (uuid->string (uuid-bytevector root-device)
151 'dce))
152 ((file-system-label? root-device)
153 (file-system-label->string root-device))
154 (else root-device)))
155 #~(string-append "--system=" #$system)
156 #~(string-append "--load=" #$system "/boot")))
33f0aa88 157
033adfe7
LC
158;; System-wide configuration.
159;; TODO: Add per-field docstrings/stexi.
160(define-record-type* <operating-system> operating-system
161 make-operating-system
162 operating-system?
d8bead6c
LC
163 this-operating-system
164
033adfe7 165 (kernel operating-system-kernel ; package
57082417 166 (default linux-libre))
af98d25a 167 (kernel-arguments operating-system-user-kernel-arguments
5582aa8e 168 (default '("quiet"))) ; list of gexps/strings
b09a8da4 169 (bootloader operating-system-bootloader) ; <bootloader-configuration>
3f03a198
LC
170 (label operating-system-label ; string
171 (thunked)
172 (default (operating-system-default-label this-operating-system)))
d5b429ab 173
ae7a316b
LC
174 (keyboard-layout operating-system-keyboard-layout ;#f | <keyboard-layout>
175 (default #f))
e34ae75d 176 (initrd operating-system-initrd ; (list fs) -> file-like
060238ae 177 (default base-initrd))
bc499b11
LC
178 (initrd-modules operating-system-initrd-modules ; list of strings
179 (thunked) ; it's system-dependent
180 (default %base-initrd-modules))
181
f34c56be
LC
182 (firmware operating-system-firmware ; list of packages
183 (default %base-firmware))
033adfe7
LC
184
185 (host-name operating-system-host-name) ; string
24e02c28 186 (hosts-file operating-system-hosts-file ; file-like | #f
c65e1834 187 (default #f))
033adfe7 188
5dae0186
LC
189 (mapped-devices operating-system-mapped-devices ; list of <mapped-device>
190 (default '()))
8a6d2731 191 (file-systems operating-system-file-systems) ; list of fs
2a13d05e
LC
192 (swap-devices operating-system-swap-devices ; list of strings
193 (default '()))
033adfe7
LC
194
195 (users operating-system-users ; list of user accounts
bf87f38a 196 (default %base-user-accounts))
033adfe7 197 (groups operating-system-groups ; list of user groups
773e956d 198 (default %base-groups))
033adfe7 199
ac3c14fb 200 (skeletons operating-system-skeletons ; list of name/file-like value
40281c54 201 (default (default-skeletons)))
548d4c13
LC
202 (issue operating-system-issue ; string
203 (default %default-issue))
40281c54 204
033adfe7 205 (packages operating-system-packages ; list of (PACKAGE OUTPUT...)
6f436c54 206 (default %base-packages)) ; or just PACKAGE
033adfe7
LC
207
208 (timezone operating-system-timezone) ; string
8a6d2731 209 (locale operating-system-locale ; string
598e19dc
LC
210 (default "en_US.utf8"))
211 (locale-definitions operating-system-locale-definitions ; list of <locale-definition>
212 (default %default-locale-definitions))
34760ae7
LC
213 (locale-libcs operating-system-locale-libcs ; list of <packages>
214 (default %default-locale-libcs))
996ed739
LC
215 (name-service-switch operating-system-name-service-switch ; <name-service-switch>
216 (default %default-nss))
033adfe7 217
69cae3d3
LC
218 (essential-services operating-system-essential-services ; list of services
219 (thunked)
f8885eca
LC
220 (default (operating-system-default-essential-services
221 this-operating-system)))
ac3c14fb 222 (services operating-system-user-services ; list of services
09e028f4
LC
223 (default %base-services))
224
225 (pam-services operating-system-pam-services ; list of PAM services
226 (default (base-pam-services)))
227 (setuid-programs operating-system-setuid-programs
69689380 228 (default %setuid-programs)) ; list of string-valued gexps
033adfe7 229
f5a9ffa0
AK
230 (sudoers-file operating-system-sudoers-file ; file-like
231 (default %sudoers-specification)))
033adfe7 232
a7ef45d9 233(define (operating-system-kernel-arguments os root-device)
33f0aa88
DM
234 "Return all the kernel arguments, including the ones not specified
235directly by the user."
a7ef45d9
LC
236 (append (bootable-kernel-arguments os root-device)
237 (operating-system-user-kernel-arguments os)))
33f0aa88 238
2717a89a 239\f
8e815c5b
LC
240;;;
241;;; Boot parameters
242;;;
243
244(define-record-type* <boot-parameters>
245 boot-parameters make-boot-parameters boot-parameters?
246 (label boot-parameters-label)
247 ;; Because we will use the 'store-device' to create the GRUB search command,
248 ;; the 'store-device' has slightly different semantics than 'root-device'.
249 ;; The 'store-device' can be a file system uuid, a file system label, or #f,
250 ;; but it cannot be a device path such as "/dev/sda3", since GRUB would not
251 ;; understand that. The 'root-device', on the other hand, corresponds
252 ;; exactly to the device field of the <file-system> object representing the
253 ;; OS's root file system, so it might be a device path like "/dev/sda3".
254 (root-device boot-parameters-root-device)
f96752e3 255 (bootloader-name boot-parameters-bootloader-name)
a28cfee8
LC
256 (bootloader-menu-entries ;list of <menu-entry>
257 boot-parameters-bootloader-menu-entries)
8e815c5b
LC
258 (store-device boot-parameters-store-device)
259 (store-mount-point boot-parameters-store-mount-point)
260 (kernel boot-parameters-kernel)
261 (kernel-arguments boot-parameters-kernel-arguments)
262 (initrd boot-parameters-initrd))
263
90d23ed9
LC
264(define (ensure-not-/dev device)
265 "If DEVICE starts with a slash, return #f. This is meant to filter out
266Linux device names such as /dev/sda, and to preserve GRUB device names and
267file system labels."
268 (if (and (string? device) (string-prefix? "/" device))
269 #f
270 device))
271
8e815c5b
LC
272(define (read-boot-parameters port)
273 "Read boot parameters from PORT and return the corresponding
274<boot-parameters> object or #f if the format is unrecognized."
075681d3
LC
275 (define device-sexp->device
276 (match-lambda
277 (('uuid (? symbol? type) (? bytevector? bv))
278 (bytevector->uuid bv type))
a5acc17a
LC
279 (('file-system-label (? string? label))
280 (file-system-label label))
075681d3
LC
281 ((? bytevector? bv) ;old format
282 (bytevector->uuid bv 'dce))
283 ((? string? device)
a5acc17a
LC
284 ;; It used to be that we would not distinguish between labels and
285 ;; device names. Try to infer the right thing here.
286 (if (string-prefix? "/dev/" device)
287 device
288 (file-system-label device)))))
075681d3 289
8e815c5b
LC
290 (match (read port)
291 (('boot-parameters ('version 0)
292 ('label label) ('root-device root)
293 ('kernel linux)
294 rest ...)
295 (boot-parameters
296 (label label)
7940188e 297 (root-device (device-sexp->device root))
8e815c5b 298
f96752e3
MO
299 (bootloader-name
300 (match (assq 'bootloader-name rest)
bcaf67c4
MO
301 ((_ args) args)
302 (#f 'grub))) ; for compatibility reasons.
303
a28cfee8
LC
304 (bootloader-menu-entries
305 (match (assq 'bootloader-menu-entries rest)
306 ((_ entries) (map sexp->menu-entry entries))
307 (#f '())))
308
8e815c5b
LC
309 ;; In the past, we would store the directory name of the kernel instead
310 ;; of the absolute file name of its image. Detect that and correct it.
311 (kernel (if (string=? linux (direct-store-path linux))
312 (string-append linux "/"
313 (system-linux-image-file-name))
314 linux))
315
316 (kernel-arguments
317 (match (assq 'kernel-arguments rest)
318 ((_ args) args)
319 (#f '()))) ;the old format
320
321 (initrd
322 (match (assq 'initrd rest)
323 (('initrd ('string-append directory file)) ;the old format
324 (string-append directory file))
325 (('initrd (? string? file))
326 file)))
327
328 (store-device
db4e8fd5
LC
329 ;; Linux device names like "/dev/sda1" are not suitable GRUB device
330 ;; identifiers, so we just filter them out.
331 (ensure-not-/dev
332 (match (assq 'store rest)
333 (('store ('device #f) _ ...)
334 root-device)
335 (('store ('device device) _ ...)
336 (device-sexp->device device))
337 (_ ;the old format
338 root-device))))
8e815c5b
LC
339
340 (store-mount-point
341 (match (assq 'store rest)
342 (('store ('device _) ('mount-point mount-point) _ ...)
343 mount-point)
344 (_ ;the old format
345 "/")))))
346 (x ;unsupported format
b1059b38
LC
347 (warning (G_ "unrecognized boot parameters at '~a'~%")
348 (port-filename port))
8e815c5b
LC
349 #f)))
350
351(define (read-boot-parameters-file system)
352 "Read boot parameters from SYSTEM's (system or generation) \"parameters\"
353file and returns the corresponding <boot-parameters> object or #f if the
354format is unrecognized.
355The object has its kernel-arguments extended in order to make it bootable."
356 (let* ((file (string-append system "/parameters"))
357 (params (call-with-input-file file read-boot-parameters))
a7ef45d9
LC
358 (root (boot-parameters-root-device params)))
359 (boot-parameters
360 (inherit params)
361 (kernel-arguments (append (bootable-kernel-arguments system root)
362 (boot-parameters-kernel-arguments params))))))
8b22107e 363
1975c754
DM
364(define (boot-parameters->menu-entry conf)
365 (menu-entry
366 (label (boot-parameters-label conf))
367 (device (boot-parameters-store-device conf))
368 (device-mount-point (boot-parameters-store-mount-point conf))
369 (linux (boot-parameters-kernel conf))
370 (linux-arguments (boot-parameters-kernel-arguments conf))
371 (initrd (boot-parameters-initrd conf))))
372
8b22107e 373
8e815c5b 374\f
40281c54
LC
375;;;
376;;; Services.
377;;;
378
aa1145df
LC
379(define (non-boot-file-system-service os)
380 "Return the file system service for the file systems of OS that are not
381marked as 'needed-for-boot'."
023f391c 382 (define file-systems
4d6b879c 383 (remove file-system-needed-for-boot?
023f391c
LC
384 (operating-system-file-systems os)))
385
68a58775
LC
386 (define mapped-devices-for-boot
387 (operating-system-boot-mapped-devices os))
388
5dae0186 389 (define (device-mappings fs)
ab64483f 390 (let ((device (file-system-device fs)))
29824d80 391 (if (string? device) ;title is 'device
ab64483f
LC
392 (filter (lambda (md)
393 (string=? (string-append "/dev/mapper/"
394 (mapped-device-target md))
395 device))
396 (operating-system-mapped-devices os))
397 '())))
5dae0186 398
e502bf89
LC
399 (define (add-dependencies fs)
400 ;; Add the dependencies due to device mappings to FS.
401 (file-system
402 (inherit fs)
403 (dependencies
68a58775
LC
404 (delete-duplicates
405 (remove (cut member <> mapped-devices-for-boot)
406 (append (device-mappings fs)
407 (file-system-dependencies fs)))
408 eq?))))
e502bf89 409
aa1145df
LC
410 (service file-system-service-type
411 (map add-dependencies file-systems)))
023f391c 412
68a58775
LC
413(define (mapped-device-users device file-systems)
414 "Return the subset of FILE-SYSTEMS that use DEVICE."
de1c158f 415 (let ((target (string-append "/dev/mapper/" (mapped-device-target device))))
68a58775
LC
416 (filter (lambda (fs)
417 (or (member device (file-system-dependencies fs))
418 (and (string? (file-system-device fs))
419 (string=? (file-system-device fs) target))))
420 file-systems)))
de1c158f
LC
421
422(define (operating-system-user-mapped-devices os)
423 "Return the subset of mapped devices that can be installed in
424user-land--i.e., those not needed during boot."
9cb426b8
LC
425 (let ((devices (operating-system-mapped-devices os))
426 (file-systems (operating-system-file-systems os)))
427 (filter (lambda (md)
68a58775
LC
428 (let ((users (mapped-device-users md file-systems)))
429 (not (any file-system-needed-for-boot? users))))
9cb426b8 430 devices)))
de1c158f
LC
431
432(define (operating-system-boot-mapped-devices os)
433 "Return the subset of mapped devices that must be installed during boot,
434from the initrd."
9cb426b8
LC
435 (let ((devices (operating-system-mapped-devices os))
436 (file-systems (operating-system-file-systems os)))
437 (filter (lambda (md)
68a58775
LC
438 (let ((users (mapped-device-users md file-systems)))
439 (any file-system-needed-for-boot? users)))
9cb426b8 440 devices)))
de1c158f 441
5dae0186 442(define (device-mapping-services os)
be1c2c54 443 "Return the list of device-mapping services for OS as a list."
4da8c19e 444 (map device-mapping-service
be1c2c54 445 (operating-system-user-mapped-devices os)))
5dae0186 446
2a13d05e 447(define (swap-services os)
be1c2c54
LC
448 "Return the list of swap services for OS."
449 (map swap-service (operating-system-swap-devices os)))
2a13d05e 450
d4ddf22d 451(define* (system-linux-image-file-name)
44d5f54e
LC
452 "Return the basename of the kernel image file for SYSTEM."
453 ;; FIXME: Evaluate the conditional based on the actual current system.
d4ddf22d
MO
454 (let ((target (or (%current-target-system) (%current-system))))
455 (cond
456 ((string-prefix? "arm" target) "zImage")
457 ((string-prefix? "mips" target) "vmlinuz")
458 ((string-prefix? "aarch64" target) "Image")
459 (else "bzImage"))))
44d5f54e
LC
460
461(define (operating-system-kernel-file os)
462 "Return an object representing the absolute file name of the kernel image of
463OS."
464 (file-append (operating-system-kernel os)
d4ddf22d 465 "/" (system-linux-image-file-name)))
44d5f54e 466
69cae3d3 467(define* (operating-system-directory-base-entries os)
d62e201c
LC
468 "Return the basic entries of the 'system' directory of OS for use as the
469value of the SYSTEM-SERVICE-TYPE service."
b19a49d0 470 (let ((locale (operating-system-locale-directory os)))
69cae3d3
LC
471 (mlet %store-monad ((kernel -> (operating-system-kernel os))
472 (initrd -> (operating-system-initrd-file os))
473 (params (operating-system-boot-parameters-file os)))
474 (return `(("kernel" ,kernel)
475 ("parameters" ,params)
476 ("initrd" ,initrd)
477 ("locale" ,locale)))))) ;used by libc
478
f8885eca 479(define (operating-system-default-essential-services os)
217a5b85
LC
480 "Return the list of essential services for OS. These are special services
481that implement part of what's declared in OS are responsible for low-level
69cae3d3 482bookkeeping."
d6e2a622
LC
483 (define known-fs
484 (map file-system-mount-point (operating-system-file-systems os)))
485
be1c2c54
LC
486 (let* ((mappings (device-mapping-services os))
487 (root-fs (root-file-system-service))
aa1145df 488 (other-fs (non-boot-file-system-service os))
be1c2c54 489 (swaps (swap-services os))
206a28d8 490 (procs (service user-processes-service-type))
d62e201c 491 (host-name (host-name-service (operating-system-host-name os)))
69cae3d3 492 (entries (operating-system-directory-base-entries os)))
d62e201c
LC
493 (cons* (service system-service-type entries)
494 %boot-service
0adfe95a 495
661c237b 496 ;; %SHEPHERD-ROOT-SERVICE must come last so that the gexp that
d4053c71 497 ;; execs shepherd comes last in the boot script (XXX). Likewise,
661c237b 498 ;; the cleanup service must come first so that its gexp runs before
d4053c71 499 ;; activation code.
be7be9e8 500 (service cleanup-service-type #f)
661c237b
LC
501 %activation-service
502 %shepherd-root-service
0adfe95a
LC
503
504 (pam-root-service (operating-system-pam-services os))
505 (account-service (append (operating-system-accounts os)
506 (operating-system-groups os))
507 (operating-system-skeletons os))
508 (operating-system-etc-service os)
aea1a42e
LC
509 (service fstab-service-type
510 (filter file-system-needed-for-boot?
511 (operating-system-file-systems os)))
6bad7524
SB
512 (session-environment-service
513 (operating-system-environment-variables os))
6c445817 514 host-name procs root-fs
0adfe95a
LC
515 (service setuid-program-service-type
516 (operating-system-setuid-programs os))
af4c3fd5
LC
517 (service profile-service-type
518 (operating-system-packages os))
aa1145df
LC
519 other-fs
520 (append mappings swaps
0adfe95a 521
69cae3d3
LC
522 ;; Add the firmware service.
523 (list %linux-bare-metal-service
524 (service firmware-service-type
525 (operating-system-firmware os)))))))
526
527(define* (operating-system-services os)
528 "Return all the services of OS, including \"essential\" services."
d466b1fc
LC
529 (instantiate-missing-services
530 (append (operating-system-user-services os)
69cae3d3 531 (operating-system-essential-services os))))
217a5b85 532
9fcfe30d
LC
533(define (operating-system-with-gc-roots os roots)
534 "Return a variant of OS where ROOTS are registered as GC roots."
535 (operating-system
536 (inherit os)
537
538 ;; We use this procedure for the installation OS, which already defines GC
539 ;; roots. Add ROOTS to those.
540 (services (cons (simple-service 'extra-root
541 gc-root-service-type roots)
542 (operating-system-user-services os)))))
543
33b7cb7a
LC
544(define* (operating-system-with-provenance os #:optional config-file)
545 "Return a variant of OS that stores its own provenance information,
546including CONFIG-FILE, if available. This is achieved by adding an instance
547of PROVENANCE-SERVICE-TYPE to its services."
548 (operating-system
549 (inherit os)
550 (services (cons (service provenance-service-type config-file)
551 (operating-system-user-services os)))))
552
40281c54
LC
553\f
554;;;
555;;; /etc.
556;;;
557
f34c56be
LC
558(define %base-firmware
559 ;; Firmware usable by default.
52db41af
EB
560 (list ath9k-htc-firmware
561 openfwwf-firmware))
f34c56be 562
6f436c54
LC
563(define %base-packages
564 ;; Default set of packages globally visible. It should include anything
565 ;; required for basic administrator tasks.
55e70e65 566 (cons* procps psmisc which less zile nano
a96a82d7 567 pciutils usbutils
01bb039e 568 util-linux+udev
af23710f 569 inetutils isc-dhcp
87941d1d 570 (@ (gnu packages admin) shadow) ;for 'passwd'
be681773
LC
571
572 ;; wireless-tools is deprecated in favor of iw, but it's still what
573 ;; many people are familiar with, so keep it around.
5146f22b 574 iw wireless-tools
be681773 575
5dccaffe 576 iproute
18316d86 577 man-db
02683c33 578 info-reader ;the standalone Info reader (no Perl)
03e9998f 579
a8a086e3
LC
580 ;; The 'sudo' command is already in %SETUID-PROGRAMS, but we also
581 ;; want the other commands and the man pages (notably because
582 ;; auto-completion in Emacs shell relies on man pages.)
583 sudo
584
03e9998f
LC
585 ;; Get 'insmod' & co. from kmod, not module-init-tools, since udev
586 ;; already depends on it anyway.
255f7308 587 kmod eudev
03e9998f 588
b63dbd44 589 e2fsprogs kbd
9b762b8d 590
1d167b6e
LC
591 bash-completion
592
86f23092
LC
593 ;; XXX: We don't use (canonical-package guile-2.2) here because that
594 ;; would create a collision in the global profile between the GMP
595 ;; variant propagated by 'guile-final' and the GMP variant propagated
596 ;; by 'gnutls', itself propagated by 'guix'.
597 guile-2.2
01ac0e6b 598 guile-readline guile-colorized
86f23092 599
9b762b8d
LC
600 ;; The packages below are also in %FINAL-INPUTS, so take them from
601 ;; there to avoid duplication.
602 (map canonical-package
86f23092 603 (list bash coreutils findutils grep sed
4b164c45 604 diffutils patch gawk tar gzip bzip2 xz lzip))))
6f436c54 605
548d4c13
LC
606(define %default-issue
607 ;; Default contents for /etc/issue.
608 "
609This is the GNU system. Welcome.\n")
610
568841d4
LC
611(define (local-host-aliases host-name)
612 "Return aliases for HOST-NAME, to be used in /etc/hosts."
613 (string-append "127.0.0.1 localhost " host-name "\n"
614 "::1 localhost " host-name "\n"))
615
c65e1834
LC
616(define (default-/etc/hosts host-name)
617 "Return the default /etc/hosts file."
24e02c28 618 (plain-file "hosts" (local-host-aliases host-name)))
c65e1834 619
0adfe95a
LC
620(define* (operating-system-etc-service os)
621 "Return a <service> that builds containing the static part of the /etc
622directory."
e453da13
LF
623 (let ((login.defs
624 (plain-file "login.defs"
625 (string-append
626 "# Default paths for non-login shells started by su(1).\n"
627 "ENV_PATH /run/setuid-programs:"
628 "/run/current-system/profile/bin:"
629 "/run/current-system/profile/sbin\n"
630 "ENV_SUPATH /run/setuid-programs:"
631 "/run/current-system/profile/bin:"
632 "/run/current-system/profile/sbin\n")))
0adfe95a 633
0adfe95a
LC
634 (issue (plain-file "issue" (operating-system-issue os)))
635 (nsswitch (plain-file "nsswitch.conf"
636 (name-service-switch->string
637 (operating-system-name-service-switch os))))
638
639 ;; Startup file for POSIX-compliant login shells, which set system-wide
640 ;; environment variables.
641 (profile (mixed-text-file "profile" "\
c05c4321 642# Crucial variables that could be missing in the profiles' 'etc/profile'
d9959421
LC
643# because they would require combining both profiles.
644# FIXME: See <http://bugs.gnu.org/20255>.
97ab2c0f 645export MANPATH=$HOME/.guix-profile/share/man:/run/current-system/profile/share/man
8d09bfe2 646export INFOPATH=$HOME/.guix-profile/share/info:/run/current-system/profile/share/info
00239d05
SB
647export XDG_DATA_DIRS=$HOME/.guix-profile/share:/run/current-system/profile/share
648export XDG_CONFIG_DIRS=$HOME/.guix-profile/etc/xdg:/run/current-system/profile/etc/xdg
649
ce380150
TD
650# Make sure libXcursor finds cursors installed into user or system profiles. See <http://bugs.gnu.org/24445>
651export XCURSOR_PATH=$HOME/.icons:$HOME/.guix-profile/share/icons:/run/current-system/profile/share/icons
652
d9959421
LC
653# Ignore the default value of 'PATH'.
654unset PATH
655
656# Load the system profile's settings.
bd7e136d 657GUIX_PROFILE=/run/current-system/profile ; \\
669786da 658. /run/current-system/profile/etc/profile
d9959421 659
cad7e6ab
CSLL
660# Since 'lshd' does not use pam_env, /etc/environment must be explicitly
661# loaded when someone logs in via SSH. See <http://bugs.gnu.org/22175>.
662# We need 'PATH' to be defined here, for 'cat' and 'cut'. Do this before
663# reading the user's 'etc/profile' to allow variables to be overridden.
664if [ -f /etc/environment -a -n \"$SSH_CLIENT\" \\
665 -a -z \"$LINUX_MODULE_DIRECTORY\" ]
666then
667 . /etc/environment
668 export `cat /etc/environment | cut -d= -f1`
669fi
670
8d09bfe2
LC
671# Arrange so that ~/.config/guix/current comes first.
672for profile in \"$HOME/.guix-profile\" \"$HOME/.config/guix/current\"
cdc5b932
LC
673do
674 if [ -f \"$profile/etc/profile\" ]
675 then
676 # Load the user profile's settings.
677 GUIX_PROFILE=\"$profile\" ; \\
678 . \"$profile/etc/profile\"
679 else
680 # At least define this one so that basic things just work
681 # when the user installs their first package.
682 export PATH=\"$profile/bin:$PATH\"
683 fi
684done
d9959421 685
a854525a
LC
686# Prepend setuid programs.
687export PATH=/run/setuid-programs:$PATH
688
8d09bfe2
LC
689# Arrange so that ~/.config/guix/current/share/info comes first.
690export INFOPATH=\"$HOME/.config/guix/current/share/info:$INFOPATH\"
691
11202482
LC
692# Set the umask, notably for users logging in via 'lsh'.
693# See <http://bugs.gnu.org/22650>.
694umask 022
2a5f0db4 695
c08da2ee
LC
696# Allow Hunspell-based applications (IceCat, LibreOffice, etc.) to
697# find dictionaries.
698export DICPATH=\"$HOME/.guix-profile/share/hunspell:/run/current-system/profile/share/hunspell\"
699
4af7c83b
LC
700# Allow GStreamer-based applications to find plugins.
701export GST_PLUGIN_PATH=\"$HOME/.guix-profile/lib/gstreamer-1.0\"
702
1d167b6e
LC
703if [ -n \"$BASH_VERSION\" -a -f /etc/bashrc ]
704then
705 # Load Bash-specific initialization code.
669786da 706 . /etc/bashrc
1d167b6e 707fi
40281c54 708"))
1d167b6e 709
0adfe95a 710 (bashrc (plain-file "bashrc" "\
1d167b6e
LC
711# Bash-specific initialization.
712
713# The 'bash-completion' package.
714if [ -f /run/current-system/profile/etc/profile.d/bash_completion.sh ]
715then
716 # Bash-completion sources ~/.bash_completion. It installs a dynamic
717 # completion loader that searches its own completion files as well
718 # as those in ~/.guix-profile and /run/current-system/profile.
719 source /run/current-system/profile/etc/profile.d/bash_completion.sh
0adfe95a
LC
720fi\n")))
721 (etc-service
9e41130b
LC
722 `(("services" ,(file-append net-base "/etc/services"))
723 ("protocols" ,(file-append net-base "/etc/protocols"))
724 ("rpc" ,(file-append net-base "/etc/rpc"))
0adfe95a
LC
725 ("login.defs" ,#~#$login.defs)
726 ("issue" ,#~#$issue)
727 ("nsswitch.conf" ,#~#$nsswitch)
0adfe95a
LC
728 ("profile" ,#~#$profile)
729 ("bashrc" ,#~#$bashrc)
730 ("hosts" ,#~#$(or (operating-system-hosts-file os)
731 (default-/etc/hosts (operating-system-host-name os))))
c694520b
TD
732 ;; Write the operating-system-host-name to /etc/hostname to prevent
733 ;; NetworkManager from changing the system's hostname when connecting
734 ;; to certain networks. Some discussion at
735 ;; https://lists.gnu.org/archive/html/help-guix/2017-09/msg00037.html
736 ("hostname" ,(plain-file "hostname" (operating-system-host-name os)))
2a80d9e5
TS
737 ;; Some programs (e.g., GLib) look at /etc/timezone to find the
738 ;; name of the current timezone. For details, see
739 ;; https://lists.gnu.org/archive/html/guix-devel/2019-07/msg00166.html
740 ("timezone" ,(plain-file "timezone" (operating-system-timezone os)))
9e41130b
LC
741 ("localtime" ,(file-append tzdata "/share/zoneinfo/"
742 (operating-system-timezone os)))
0adfe95a 743 ("sudoers" ,(operating-system-sudoers-file os))))))
033adfe7 744
ab6a279a
LC
745(define %root-account
746 ;; Default root account.
747 (user-account
748 (name "root")
749 (password "")
750 (uid 0) (group "root")
751 (comment "System administrator")
752 (home-directory "/root")))
753
0b6f49ef 754(define (operating-system-accounts os)
0adfe95a
LC
755 "Return the user accounts for OS, including an obligatory 'root' account,
756and excluding accounts requested by services."
757 ;; Make sure there's a root account.
758 (if (find (lambda (user)
759 (and=> (user-account-uid user) zero?))
760 (operating-system-users os))
761 (operating-system-users os)
762 (cons %root-account (operating-system-users os))))
0b6f49ef 763
84765839
LC
764(define (maybe-string->file file-name thing)
765 "If THING is a string, return a <plain-file> with THING as its content.
766Otherwise just return THING.
767
768This is for backward-compatibility of fields that used to be strings and are
769now file-like objects.."
770 (match thing
771 ((? string?)
69daee23 772 (warning (G_ "using a string for file '~a' is deprecated; \
84765839
LC
773use 'plain-file' instead~%")
774 file-name)
775 (plain-file file-name thing))
776 (x
777 x)))
778
24e02c28
LC
779(define (maybe-file->monadic file-name thing)
780 "If THING is a value in %STORE-MONAD, return it as is; otherwise return
781THING in the %STORE-MONAD.
782
783This is for backward-compatibility of fields that used to be monadic values
784and are now file-like objects."
785 (with-monad %store-monad
786 (match thing
787 ((? procedure?)
69daee23 788 (warning (G_ "using a monadic value for '~a' is deprecated; \
24e02c28
LC
789use 'plain-file' instead~%")
790 file-name)
791 thing)
792 (x
793 (return x)))))
794
0b6f49ef
LC
795(define (operating-system-etc-directory os)
796 "Return that static part of the /etc directory of OS."
0adfe95a
LC
797 (etc-directory
798 (fold-services (operating-system-services os)
799 #:target-type etc-service-type)))
033adfe7 800
6bad7524
SB
801(define (operating-system-environment-variables os)
802 "Return the environment variables of OS for
803@var{session-environment-service-type}, to be used in @file{/etc/environment}."
804 `(("LANG" . ,(operating-system-locale os))
54757499
LC
805 ;; Note: No need to set 'TZ' since (1) we provide /etc/localtime, and (2)
806 ;; it doesn't work for setuid binaries. See <https://bugs.gnu.org/29212>.
9e41130b 807 ("TZDIR" . ,(file-append tzdata "/share/zoneinfo"))
6bad7524
SB
808 ;; Tell 'modprobe' & co. where to look for modules.
809 ("LINUX_MODULE_DIRECTORY" . "/run/booted-system/kernel/lib/modules")
810 ;; These variables are honored by OpenSSL (libssl) and Git.
811 ("SSL_CERT_DIR" . "/etc/ssl/certs")
812 ("SSL_CERT_FILE" . "/etc/ssl/certs/ca-certificates.crt")
813 ("GIT_SSL_CAINFO" . "/etc/ssl/certs/ca-certificates.crt")
ae05e366
LC
814
815 ;; 'GTK_DATA_PREFIX' must name one directory where GTK+ themes are
816 ;; searched for.
817 ("GTK_DATA_PREFIX" . "/run/current-system/profile")
818
6bad7524
SB
819 ;; By default, applications that use D-Bus, such as Emacs, abort at startup
820 ;; when /etc/machine-id is missing. Make sure these warnings are non-fatal.
946465bb
LC
821 ("DBUS_FATAL_WARNINGS" . "0")
822
823 ;; XXX: Normally we wouldn't need to do this, but our glibc@2.23 package
824 ;; used to look things up in 'PREFIX/lib/locale' instead of
825 ;; '/run/current-system/locale' as was intended. Keep this hack around so
826 ;; that people who still have glibc@2.23-using packages in their profiles
827 ;; can use them correctly.
828 ;; TODO: Remove when glibc@2.23 is long gone.
829 ("GUIX_LOCPATH" . "/run/current-system/locale")))
6bad7524 830
09e028f4
LC
831(define %setuid-programs
832 ;; Default set of setuid-root programs.
3b65abac 833 (let ((shadow (@ (gnu packages admin) shadow)))
9e41130b
LC
834 (list (file-append shadow "/bin/passwd")
835 (file-append shadow "/bin/su")
852241eb
SB
836 (file-append shadow "/bin/newuidmap")
837 (file-append shadow "/bin/newgidmap")
9e41130b
LC
838 (file-append inetutils "/bin/ping")
839 (file-append inetutils "/bin/ping6")
840 (file-append sudo "/bin/sudo")
5144df2c 841 (file-append sudo "/bin/sudoedit")
19944227
LC
842 (file-append fuse "/bin/fusermount")
843
844 ;; To allow mounts with the "user" option, "mount" and "umount" must
845 ;; be setuid-root.
846 (file-append util-linux "/bin/mount")
847 (file-append util-linux "/bin/umount"))))
69689380
LC
848
849(define %sudoers-specification
850 ;; Default /etc/sudoers contents: 'root' and all members of the 'wheel'
851 ;; group can do anything. See
852 ;; <http://www.sudo.ws/sudo/man/1.8.10/sudoers.man.html>.
853 ;; TODO: Add a declarative API.
84765839
LC
854 (plain-file "sudoers" "\
855root ALL=(ALL) ALL
856%wheel ALL=(ALL) ALL\n"))
09e028f4 857
69cae3d3 858(define* (operating-system-activation-script os)
484a2b3a
LC
859 "Return the activation script for OS---i.e., the code that \"activates\" the
860stateful part of OS, including user accounts and groups, special directories,
861etc."
69cae3d3 862 (let* ((services (operating-system-services os))
0adfe95a
LC
863 (activation (fold-services services
864 #:target-type activation-service-type)))
865 (activation-service->script activation)))
484a2b3a 866
69cae3d3 867(define* (operating-system-boot-script os)
484a2b3a 868 "Return the boot script for OS---i.e., the code started by the initrd once
69cae3d3
LC
869we're running in the final root."
870 (let* ((services (operating-system-services os))
d62e201c 871 (boot (fold-services services #:target-type boot-service-type)))
efe7d19a 872 (service-value boot)))
2106d3fc 873
b2fef041
LC
874(define (operating-system-user-accounts os)
875 "Return the list of user accounts of OS."
876 (let* ((services (operating-system-services os))
877 (account (fold-services services
878 #:target-type account-service-type)))
879 (filter user-account?
efe7d19a 880 (service-value account))))
b2fef041
LC
881
882(define (operating-system-shepherd-service-names os)
883 "Return the list of Shepherd service names for OS."
884 (append-map shepherd-service-provision
efe7d19a 885 (service-value
b2fef041
LC
886 (fold-services (operating-system-services os)
887 #:target-type
888 shepherd-root-service-type))))
889
69cae3d3 890(define* (operating-system-derivation os)
d62e201c 891 "Return a derivation that builds OS."
69cae3d3 892 (let* ((services (operating-system-services os))
d62e201c
LC
893 (system (fold-services services)))
894 ;; SYSTEM contains the derivation as a monadic value.
efe7d19a 895 (service-value system)))
d62e201c 896
69cae3d3 897(define* (operating-system-profile os)
af4c3fd5
LC
898 "Return a derivation that builds the system profile of OS."
899 (mlet* %store-monad
69cae3d3 900 ((services -> (operating-system-services os))
af4c3fd5
LC
901 (profile (fold-services services
902 #:target-type profile-service-type)))
903 (match profile
904 (("profile" profile)
905 (return profile)))))
906
83bcd0b8
LC
907(define (operating-system-root-file-system os)
908 "Return the root file system of OS."
a48d3450
LC
909 (find (lambda (fs)
910 (string=? "/" (file-system-mount-point fs)))
83bcd0b8
LC
911 (operating-system-file-systems os)))
912
b4140694
LC
913(define (operating-system-initrd-file os)
914 "Return a gexp denoting the initrd file of OS."
83bcd0b8 915 (define boot-file-systems
4d6b879c 916 (filter file-system-needed-for-boot?
83bcd0b8
LC
917 (operating-system-file-systems os)))
918
de1c158f
LC
919 (define mapped-devices
920 (operating-system-boot-mapped-devices os))
921
922 (define make-initrd
923 (operating-system-initrd os))
924
d422cbb3
LC
925 (make-initrd boot-file-systems
926 #:linux (operating-system-kernel os)
927 #:linux-modules
928 (operating-system-initrd-modules os)
ae7a316b
LC
929 #:mapped-devices mapped-devices
930 #:keyboard-layout (operating-system-keyboard-layout os)))
b4140694 931
f5582b2c
LC
932(define (locale-name->definition* name)
933 "Variant of 'locale-name->definition' that raises an error upon failure."
934 (match (locale-name->definition name)
935 (#f
936 (raise (condition
937 (&message
69daee23 938 (message (format #f (G_ "~a: invalid locale name") name))))))
f5582b2c
LC
939 (def def)))
940
598e19dc
LC
941(define (operating-system-locale-directory os)
942 "Return the directory containing the locales compiled for the definitions
943listed in OS. The C library expects to find it under
944/run/current-system/locale."
f5582b2c
LC
945 (define name
946 (operating-system-locale os))
947
948 (define definitions
949 ;; While we're at it, check whether NAME is defined and add it if needed.
950 (if (member name (map locale-definition-name
951 (operating-system-locale-definitions os)))
952 (operating-system-locale-definitions os)
953 (cons (locale-name->definition* name)
954 (operating-system-locale-definitions os))))
955
956 (locale-directory definitions
34760ae7 957 #:libcs (operating-system-locale-libcs os)))
598e19dc 958
c2e9942b
MO
959(define (kernel->boot-label kernel)
960 "Return a label for the bootloader menu entry that boots KERNEL."
bdc61ff9
P
961 (cond ((package? kernel)
962 (string-append "GNU with "
963 (string-titlecase (package-name kernel)) " "
4ce3a326 964 (package-version kernel)))
bdc61ff9
P
965 ((inferior-package? kernel)
966 (string-append "GNU with "
b12f8720 967 (string-titlecase (inferior-package-name kernel)) " "
4ce3a326 968 (inferior-package-version kernel)))
bdc61ff9 969 (else "GNU")))
2d23e6f0 970
3f03a198
LC
971(define (operating-system-default-label os)
972 "Return the default label for OS, as it will appear in the bootloader menu
973entry."
974 (kernel->boot-label (operating-system-kernel os)))
975
6b779207
LC
976(define (store-file-system file-systems)
977 "Return the file system object among FILE-SYSTEMS that contains the store."
978 (match (filter (lambda (fs)
979 (and (file-system-mount? fs)
980 (not (memq 'bind-mount (file-system-flags fs)))
981 (string-prefix? (file-system-mount-point fs)
982 (%store-prefix))))
983 file-systems)
984 ((and candidates (head . tail))
985 (reduce (lambda (fs1 fs2)
986 (if (> (string-length (file-system-mount-point fs1))
987 (string-length (file-system-mount-point fs2)))
988 fs1
989 fs2))
990 head
991 candidates))))
992
993(define (operating-system-store-file-system os)
994 "Return the file system that contains the store of OS."
995 (store-file-system (operating-system-file-systems os)))
996
c76b3046 997(define* (operating-system-bootcfg os #:optional (old-entries '()))
5ece56dc
LC
998 "Return the bootloader configuration file for OS. Use OLD-ENTRIES,
999a list of <menu-entry>, to populate the \"old entries\" menu."
9782c822
LC
1000 (let* ((root-fs (operating-system-root-file-system os))
1001 (root-device (file-system-device root-fs))
1002 (params (operating-system-boot-parameters
1003 os root-device
1004 #:system-kernel-arguments? #t))
1005 (entry (boot-parameters->menu-entry params))
1006 (bootloader-conf (operating-system-bootloader os)))
46c296dc
LC
1007 (define generate-config-file
1008 (bootloader-configuration-file-generator
1009 (bootloader-configuration-bootloader bootloader-conf)))
1010
9782c822
LC
1011 (generate-config-file bootloader-conf (list entry)
1012 #:old-entries old-entries)))
b4140694 1013
a7ef45d9
LC
1014(define* (operating-system-boot-parameters os root-device
1015 #:key system-kernel-arguments?)
1016 "Return a monadic <boot-parameters> record that describes the boot
1017parameters of OS. When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments
1018such as '--root' and '--load' to <boot-parameters>."
35b44681
LC
1019 (let* ((initrd (operating-system-initrd-file os))
1020 (store (operating-system-store-file-system os))
1021 (bootloader (bootloader-configuration-bootloader
1022 (operating-system-bootloader os)))
1023 (bootloader-name (bootloader-name bootloader))
3f03a198 1024 (label (operating-system-label os)))
35b44681
LC
1025 (boot-parameters
1026 (label label)
1027 (root-device root-device)
1028 (kernel (operating-system-kernel-file os))
1029 (kernel-arguments
1030 (if system-kernel-arguments?
1031 (operating-system-kernel-arguments os root-device)
1032 (operating-system-user-kernel-arguments os)))
1033 (initrd initrd)
1034 (bootloader-name bootloader-name)
a28cfee8
LC
1035 (bootloader-menu-entries
1036 (bootloader-configuration-menu-entries (operating-system-bootloader os)))
35b44681
LC
1037 (store-device (ensure-not-/dev (file-system-device store)))
1038 (store-mount-point (file-system-mount-point store)))))
40fad1c2 1039
9b336338
LC
1040(define (device->sexp device)
1041 "Serialize DEVICE as an sexp (really, as an object with a read syntax.)"
1042 (match device
1043 ((? uuid? uuid)
075681d3 1044 `(uuid ,(uuid-type uuid) ,(uuid-bytevector uuid)))
a5acc17a
LC
1045 ((? file-system-label? label)
1046 `(file-system-label ,(file-system-label->string label)))
9b336338
LC
1047 (_
1048 device)))
1049
a7ef45d9
LC
1050(define* (operating-system-boot-parameters-file os
1051 #:key system-kernel-arguments?)
40fad1c2
DM
1052 "Return a file that describes the boot parameters of OS. The primary use of
1053this file is the reconstruction of GRUB menu entries for old configurations.
a7ef45d9
LC
1054
1055When SYSTEM-KERNEL-ARGUMENTS? is true, add kernel arguments such as '--root'
1056and '--load' to the returned file (since the returned file is then usually
1057stored into the content-addressed \"system\" directory, it's usually not a
1058good idea to give it because the content hash would change by the content hash
40fad1c2 1059being stored into the \"parameters\" file)."
35b44681
LC
1060 (let* ((root (operating-system-root-file-system os))
1061 (device (file-system-device root))
1062 (params (operating-system-boot-parameters
1063 os device
1064 #:system-kernel-arguments?
1065 system-kernel-arguments?)))
40fad1c2
DM
1066 (gexp->file "parameters"
1067 #~(boot-parameters
1068 (version 0)
1069 (label #$(boot-parameters-label params))
9b336338
LC
1070 (root-device
1071 #$(device->sexp
1072 (boot-parameters-root-device params)))
40fad1c2
DM
1073 (kernel #$(boot-parameters-kernel params))
1074 (kernel-arguments
1075 #$(boot-parameters-kernel-arguments params))
1076 (initrd #$(boot-parameters-initrd params))
f96752e3 1077 (bootloader-name #$(boot-parameters-bootloader-name params))
a28cfee8
LC
1078 (bootloader-menu-entries
1079 #$(map menu-entry->sexp
1080 (or (and=> (operating-system-bootloader os)
1081 bootloader-configuration-menu-entries)
1082 '())))
40fad1c2 1083 (store
9b336338
LC
1084 (device
1085 #$(device->sexp (boot-parameters-store-device params)))
40fad1c2
DM
1086 (mount-point #$(boot-parameters-store-mount-point params))))
1087 #:set-load-path? #f)))
64e40dbb 1088
96da5d62
LC
1089(define-gexp-compiler (operating-system-compiler (os <operating-system>)
1090 system target)
1091 ((store-lift
1092 (lambda (store)
1093 ;; XXX: This is not super elegant but we can't pass SYSTEM and TARGET to
1094 ;; 'operating-system-derivation'.
1095 (run-with-store store (operating-system-derivation os)
1096 #:system system
1097 #:target target)))))
1098
033adfe7 1099;;; system.scm ends here