system: Add 'grub-configuration' record.
* gnu/system/grub.scm (<grub-configuration>): New record type. (grub-configuration-file): Add 'config' parameter; remove #:default-entry and #:timeout. Honor CONFIG. * gnu/system.scm (<operating-system>): Remove 'bootloader-entries' field; remove default value for 'bootloader' field. (operating-system-grub.cfg): Pass the 'bootloader' field to 'grub-configuration-file'. * build-aux/hydra/demo-os.scm (bootloader): New field.
This commit is contained in:
parent
72b9d60df4
commit
d5b429abda
|
@ -33,6 +33,7 @@
|
||||||
(gnu packages tor)
|
(gnu packages tor)
|
||||||
(gnu packages package-management)
|
(gnu packages package-management)
|
||||||
|
|
||||||
|
(gnu system grub) ; 'grub-configuration'
|
||||||
(gnu system shadow) ; 'user-account'
|
(gnu system shadow) ; 'user-account'
|
||||||
(gnu system linux) ; 'base-pam-services'
|
(gnu system linux) ; 'base-pam-services'
|
||||||
(gnu services base)
|
(gnu services base)
|
||||||
|
@ -43,6 +44,8 @@
|
||||||
(host-name "gnu")
|
(host-name "gnu")
|
||||||
(timezone "Europe/Paris")
|
(timezone "Europe/Paris")
|
||||||
(locale "en_US.UTF-8")
|
(locale "en_US.UTF-8")
|
||||||
|
(bootloader (grub-configuration
|
||||||
|
(device "/dev/sda")))
|
||||||
(file-systems
|
(file-systems
|
||||||
;; We provide a dummy file system for /, but that's OK because the VM build
|
;; We provide a dummy file system for /, but that's OK because the VM build
|
||||||
;; code will automatically declare the / file system for us.
|
;; code will automatically declare the / file system for us.
|
||||||
|
|
|
@ -39,10 +39,11 @@
|
||||||
#:use-module (srfi srfi-26)
|
#:use-module (srfi srfi-26)
|
||||||
#:export (operating-system
|
#:export (operating-system
|
||||||
operating-system?
|
operating-system?
|
||||||
|
|
||||||
|
operating-system-bootloader
|
||||||
operating-system-services
|
operating-system-services
|
||||||
operating-system-user-services
|
operating-system-user-services
|
||||||
operating-system-packages
|
operating-system-packages
|
||||||
operating-system-bootloader-entries
|
|
||||||
operating-system-host-name
|
operating-system-host-name
|
||||||
operating-system-kernel
|
operating-system-kernel
|
||||||
operating-system-initrd
|
operating-system-initrd
|
||||||
|
@ -83,10 +84,8 @@
|
||||||
operating-system?
|
operating-system?
|
||||||
(kernel operating-system-kernel ; package
|
(kernel operating-system-kernel ; package
|
||||||
(default linux-libre))
|
(default linux-libre))
|
||||||
(bootloader operating-system-bootloader ; package
|
(bootloader operating-system-bootloader) ; <grub-configuration>
|
||||||
(default grub))
|
|
||||||
(bootloader-entries operating-system-bootloader-entries ; list
|
|
||||||
(default '()))
|
|
||||||
(initrd operating-system-initrd ; (list fs) -> M derivation
|
(initrd operating-system-initrd ; (list fs) -> M derivation
|
||||||
(default qemu-initrd))
|
(default qemu-initrd))
|
||||||
|
|
||||||
|
@ -504,7 +503,7 @@ we're running in the final root."
|
||||||
#~(string-append "--load=" #$system
|
#~(string-append "--load=" #$system
|
||||||
"/boot")))
|
"/boot")))
|
||||||
(initrd #~(string-append #$system "/initrd"))))))
|
(initrd #~(string-append #$system "/initrd"))))))
|
||||||
(grub-configuration-file entries)))
|
(grub-configuration-file (operating-system-bootloader os) entries)))
|
||||||
|
|
||||||
(define (operating-system-derivation os)
|
(define (operating-system-derivation os)
|
||||||
"Return a derivation that builds OS."
|
"Return a derivation that builds OS."
|
||||||
|
|
|
@ -25,8 +25,13 @@
|
||||||
#:use-module (guix gexp)
|
#:use-module (guix gexp)
|
||||||
#:use-module (ice-9 match)
|
#:use-module (ice-9 match)
|
||||||
#:use-module (srfi srfi-1)
|
#:use-module (srfi srfi-1)
|
||||||
#:export (menu-entry
|
#:export (grub-configuration
|
||||||
|
grub-configuration?
|
||||||
|
grub-configuration-device
|
||||||
|
|
||||||
|
menu-entry
|
||||||
menu-entry?
|
menu-entry?
|
||||||
|
|
||||||
grub-configuration-file))
|
grub-configuration-file))
|
||||||
|
|
||||||
;;; Commentary:
|
;;; Commentary:
|
||||||
|
@ -35,6 +40,19 @@
|
||||||
;;;
|
;;;
|
||||||
;;; Code:
|
;;; Code:
|
||||||
|
|
||||||
|
(define-record-type* <grub-configuration>
|
||||||
|
grub-configuration make-grub-configuration
|
||||||
|
grub-configuration?
|
||||||
|
(grub grub-configuration-grub ; package
|
||||||
|
(default (@ (gnu packages grub) grub)))
|
||||||
|
(device grub-configuration-device) ; string
|
||||||
|
(menu-entries grub-configuration-menu-entries ; list
|
||||||
|
(default '()))
|
||||||
|
(default-entry grub-configuration-default-entry ; integer
|
||||||
|
(default 1))
|
||||||
|
(timeout grub-configuration-timeout ; integer
|
||||||
|
(default 5)))
|
||||||
|
|
||||||
(define-record-type* <menu-entry>
|
(define-record-type* <menu-entry>
|
||||||
menu-entry make-menu-entry
|
menu-entry make-menu-entry
|
||||||
menu-entry?
|
menu-entry?
|
||||||
|
@ -44,11 +62,13 @@
|
||||||
(default '())) ; list of string-valued gexps
|
(default '())) ; list of string-valued gexps
|
||||||
(initrd menu-entry-initrd)) ; file name of the initrd as a gexp
|
(initrd menu-entry-initrd)) ; file name of the initrd as a gexp
|
||||||
|
|
||||||
(define* (grub-configuration-file entries
|
(define* (grub-configuration-file config entries
|
||||||
#:key (default-entry 1) (timeout 5)
|
#:key (system (%current-system)))
|
||||||
(system (%current-system)))
|
"Return the GRUB configuration file corresponding to CONFIG, a
|
||||||
"Return the GRUB configuration file for ENTRIES, a list of
|
<grub-configuration> object."
|
||||||
<menu-entry> objects, defaulting to DEFAULT-ENTRY and with the given TIMEOUT."
|
(define all-entries
|
||||||
|
(append entries (grub-configuration-menu-entries config)))
|
||||||
|
|
||||||
(define entry->gexp
|
(define entry->gexp
|
||||||
(match-lambda
|
(match-lambda
|
||||||
(($ <menu-entry> label linux arguments initrd)
|
(($ <menu-entry> label linux arguments initrd)
|
||||||
|
@ -67,12 +87,13 @@
|
||||||
set default=~a
|
set default=~a
|
||||||
set timeout=~a
|
set timeout=~a
|
||||||
search.file ~a/bzImage~%"
|
search.file ~a/bzImage~%"
|
||||||
#$default-entry #$timeout
|
#$(grub-configuration-default-entry config)
|
||||||
|
#$(grub-configuration-timeout config)
|
||||||
#$(any (match-lambda
|
#$(any (match-lambda
|
||||||
(($ <menu-entry> _ linux)
|
(($ <menu-entry> _ linux)
|
||||||
linux))
|
linux))
|
||||||
entries))
|
all-entries))
|
||||||
#$@(map entry->gexp entries))))
|
#$@(map entry->gexp all-entries))))
|
||||||
|
|
||||||
(gexp->derivation "grub.cfg" builder))
|
(gexp->derivation "grub.cfg" builder))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue