system: Add 'operating-system-boot-script'.

* gnu/system.scm (operating-system-boot-script): New procedure.
  (operating-system-derivation): Use it.  Remove DMD-CONF from the
  file union.  Add BOOT-DRV to the inputs.
This commit is contained in:
Ludovic Courtès 2014-04-23 16:52:14 +02:00
parent 0b6f49ef69
commit 2106d3fc81
1 changed files with 18 additions and 12 deletions

View File

@ -325,23 +325,29 @@ alias ll='ls -l'
#:timezone (operating-system-timezone os) #:timezone (operating-system-timezone os)
#:profile profile-drv))) #:profile profile-drv)))
(define (operating-system-boot-script os)
"Return the boot script for OS---i.e., the code started by the initrd once
we're running in the final root."
(mlet* %store-monad
((services (sequence %store-monad (operating-system-services os)))
(etc (operating-system-etc-directory os))
(dmd-conf (dmd-configuration-file services
(derivation->output-path etc))))
;; FIXME: Use 'sexp-file' or similar.
(text-file* "boot"
"(execl \"" dmd "/bin/dmd\" \"dmd\"
\"--config\" \"" dmd-conf "\")")))
(define (operating-system-derivation os) (define (operating-system-derivation os)
"Return a derivation that builds OS." "Return a derivation that builds OS."
(mlet* %store-monad (mlet* %store-monad
((bash-file (package-file bash "bin/bash")) ((profile-drv (operating-system-profile-derivation os))
(dmd-file (package-file (@ (gnu packages admin) dmd) "bin/dmd"))
(profile-drv (operating-system-profile-derivation os))
(profile -> (derivation->output-path profile-drv)) (profile -> (derivation->output-path profile-drv))
(etc-drv (operating-system-etc-directory os)) (etc-drv (operating-system-etc-directory os))
(etc -> (derivation->output-path etc-drv)) (etc -> (derivation->output-path etc-drv))
(services (sequence %store-monad (operating-system-services os))) (services (sequence %store-monad (operating-system-services os)))
(dmd-conf (dmd-configuration-file services etc)) (boot-drv (operating-system-boot-script os))
(boot -> (derivation->output-path boot-drv))
(boot (text-file "boot"
(object->string
`(execl ,dmd-file "dmd"
"--config" ,dmd-conf))))
(kernel -> (operating-system-kernel os)) (kernel -> (operating-system-kernel os))
(kernel-dir (package-file kernel)) (kernel-dir (package-file kernel))
(initrd (operating-system-initrd os)) (initrd (operating-system-initrd os))
@ -364,12 +370,12 @@ alias ll='ls -l'
(file-union `(("boot" ,boot) (file-union `(("boot" ,boot)
("kernel" ,kernel-dir) ("kernel" ,kernel-dir)
("initrd" ,initrd-file) ("initrd" ,initrd-file)
("dmd.conf" ,dmd-conf)
("profile" ,profile) ("profile" ,profile)
("grub.cfg" ,grub.cfg) ("grub.cfg" ,grub.cfg)
("etc" ,etc) ("etc" ,etc)
("system-inputs" ,(derivation->output-path extras))) ("system-inputs" ,(derivation->output-path extras)))
#:inputs `(("kernel" ,kernel) #:inputs `(("boot" ,boot-drv)
("kernel" ,kernel)
("initrd" ,initrd) ("initrd" ,initrd)
("bash" ,bash) ("bash" ,bash)
("profile" ,profile-drv) ("profile" ,profile-drv)