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