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