From ae7a316b9da0d1a50c5abdc531c68c8e98e561c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 20 Mar 2019 12:19:14 +0100 Subject: system: Initialize console keyboard layout in the initrd. Partially fixes . * gnu/system.scm ()[keyboard-layout]: New field. (operating-system-initrd-file): Pass #:keyboard-layout to MAKE-INITRD. * gnu/system/linux-initrd.scm (raw-initrd): Add #:keyboard-layout. Pass #:keymap-file to 'boot-system'. (base-initrd): Add #:keyboard-layout. [helper-packages]: Add LOADKEYS-STATIC when KEYBOARD-LAYOUT is true. Pass #:keyboard-layout to 'raw-initrd'. * gnu/build/linux-boot.scm (boot-system): Add #:keymap-file and honor it. * doc/guix.texi (operating-system Reference): Document the 'keyboard-layout' field. (Initial RAM Disk): Update 'raw-initrd' and 'base-initrd' documentation. --- gnu/system.scm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gnu/system.scm') diff --git a/gnu/system.scm b/gnu/system.scm index 6bccdaa8c2..035bbd82a1 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2015, 2016 Alex Kost ;;; Copyright © 2016 Chris Marusich @@ -157,6 +157,8 @@ (default '())) ; list of gexps/strings (bootloader operating-system-bootloader) ; + (keyboard-layout operating-system-keyboard-layout ;#f | + (default #f)) (initrd operating-system-initrd ; (list fs) -> file-like (default base-initrd)) (initrd-modules operating-system-initrd-modules ; list of strings @@ -878,7 +880,8 @@ hardware-related operations as necessary when booting a Linux container." #:linux (operating-system-kernel os) #:linux-modules (operating-system-initrd-modules os) - #:mapped-devices mapped-devices)) + #:mapped-devices mapped-devices + #:keyboard-layout (operating-system-keyboard-layout os))) (define (locale-name->definition* name) "Variant of 'locale-name->definition' that raises an error upon failure." -- cgit v1.2.3 From 69cae3d3356a69b7fe69481338f760545995485e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 22 Mar 2019 17:48:37 +0100 Subject: system: Add 'essential-services' field to . * gnu/system.scm ()[essential-services]: New field. (operating-system-directory-base-entries): Remove #:container? keyword and keep only the not-container branch. (essential-services): Likewise. (operating-system-services): Likewise, and call 'operating-system-essential-services' instead of 'essential-services'. (operating-system-activation-script): Remove #:container?. (operating-system-boot-script): Likewise. (operating-system-derivation): Likewise. * gnu/system/linux-container.scm (container-essential-services): New procedure. (containerized-operating-system): Use it and set the 'essential-services' field. (container-script): Remove call to 'operating-system-derivation'. * gnu/system/vm.scm (system-docker-image): Likewise. * doc/guix.texi (operating-system Reference): Document 'essential-services'. --- gnu/system.scm | 73 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 33 insertions(+), 40 deletions(-) (limited to 'gnu/system.scm') diff --git a/gnu/system.scm b/gnu/system.scm index 035bbd82a1..9887d72c41 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -69,6 +69,7 @@ operating-system-bootloader operating-system-services + operating-system-essential-services operating-system-user-services operating-system-packages operating-system-host-name @@ -201,6 +202,9 @@ (name-service-switch operating-system-name-service-switch ; (default %default-nss)) + (essential-services operating-system-essential-services ; list of services + (thunked) + (default (essential-services this-record))) (services operating-system-user-services ; list of services (default %base-services)) @@ -438,27 +442,22 @@ OS." (file-append (operating-system-kernel os) "/" (system-linux-image-file-name os))) -(define* (operating-system-directory-base-entries os #:key container?) +(define* (operating-system-directory-base-entries os) "Return the basic entries of the 'system' directory of OS for use as the value of the SYSTEM-SERVICE-TYPE service." (let ((locale (operating-system-locale-directory os))) - (with-monad %store-monad - (if container? - (return `(("locale" ,locale))) - (mlet %store-monad - ((kernel -> (operating-system-kernel os)) - (initrd -> (operating-system-initrd-file os)) - (params (operating-system-boot-parameters-file os))) - (return `(("kernel" ,kernel) - ("parameters" ,params) - ("initrd" ,initrd) - ("locale" ,locale)))))))) ;used by libc - -(define* (essential-services os #:key container?) + (mlet %store-monad ((kernel -> (operating-system-kernel os)) + (initrd -> (operating-system-initrd-file os)) + (params (operating-system-boot-parameters-file os))) + (return `(("kernel" ,kernel) + ("parameters" ,params) + ("initrd" ,initrd) + ("locale" ,locale)))))) ;used by libc + +(define* (essential-services os) "Return the list of essential services for OS. These are special services that implement part of what's declared in OS are responsible for low-level -bookkeeping. CONTAINER? determines whether to return the list of services for -a container or that of a \"bare metal\" system." +bookkeeping." (define known-fs (map file-system-mount-point (operating-system-file-systems os))) @@ -468,8 +467,7 @@ a container or that of a \"bare metal\" system." (swaps (swap-services os)) (procs (service user-processes-service-type)) (host-name (host-name-service (operating-system-host-name os))) - (entries (operating-system-directory-base-entries - os #:container? container?))) + (entries (operating-system-directory-base-entries os))) (cons* (service system-service-type entries) %boot-service @@ -497,20 +495,16 @@ a container or that of a \"bare metal\" system." other-fs (append mappings swaps - ;; Add the firmware service, unless we are building for a - ;; container. - (if container? - (list %containerized-shepherd-service) - (list %linux-bare-metal-service - (service firmware-service-type - (operating-system-firmware os)))))))) - -(define* (operating-system-services os #:key container?) - "Return all the services of OS, including \"internal\" services that do not -explicitly appear in OS." + ;; Add the firmware service. + (list %linux-bare-metal-service + (service firmware-service-type + (operating-system-firmware os))))))) + +(define* (operating-system-services os) + "Return all the services of OS, including \"essential\" services." (instantiate-missing-services (append (operating-system-user-services os) - (essential-services os #:container? container?)))) + (operating-system-essential-services os)))) ;;; @@ -808,20 +802,19 @@ use 'plain-file' instead~%") root ALL=(ALL) ALL %wheel ALL=(ALL) ALL\n")) -(define* (operating-system-activation-script os #:key container?) +(define* (operating-system-activation-script os) "Return the activation script for OS---i.e., the code that \"activates\" the stateful part of OS, including user accounts and groups, special directories, etc." - (let* ((services (operating-system-services os #:container? container?)) + (let* ((services (operating-system-services os)) (activation (fold-services services #:target-type activation-service-type))) (activation-service->script activation))) -(define* (operating-system-boot-script os #:key container?) +(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. When CONTAINER? is true, skip all -hardware-related operations as necessary when booting a Linux container." - (let* ((services (operating-system-services os #:container? container?)) +we're running in the final root." + (let* ((services (operating-system-services os)) (boot (fold-services services #:target-type boot-service-type))) (service-value boot))) @@ -841,17 +834,17 @@ hardware-related operations as necessary when booting a Linux container." #:target-type shepherd-root-service-type)))) -(define* (operating-system-derivation os #:key container?) +(define* (operating-system-derivation os) "Return a derivation that builds OS." - (let* ((services (operating-system-services os #:container? container?)) + (let* ((services (operating-system-services os)) (system (fold-services services))) ;; SYSTEM contains the derivation as a monadic value. (service-value system))) -(define* (operating-system-profile os #:key container?) +(define* (operating-system-profile os) "Return a derivation that builds the system profile of OS." (mlet* %store-monad - ((services -> (operating-system-services os #:container? container?)) + ((services -> (operating-system-services os)) (profile (fold-services services #:target-type profile-service-type))) (match profile -- cgit v1.2.3 From d8bead6c5dcb8de3c86b4f84ee7c74d824135d16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Fri, 29 Mar 2019 23:22:27 +0100 Subject: system: Define 'this-operating-system'. * gnu/system.scm (): Choose 'this-operating-system' as the 'this' identifier. [essential-services]: Adjust accordingly. --- gnu/system.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gnu/system.scm') diff --git a/gnu/system.scm b/gnu/system.scm index 9887d72c41..ad0c9e57dc 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -66,6 +66,7 @@ #:use-module (rnrs bytevectors) #:export (operating-system operating-system? + this-operating-system operating-system-bootloader operating-system-services @@ -152,6 +153,8 @@ (define-record-type* operating-system make-operating-system operating-system? + this-operating-system + (kernel operating-system-kernel ; package (default linux-libre)) (kernel-arguments operating-system-user-kernel-arguments @@ -204,7 +207,7 @@ (essential-services operating-system-essential-services ; list of services (thunked) - (default (essential-services this-record))) + (default (essential-services this-operating-system))) (services operating-system-user-services ; list of services (default %base-services)) -- cgit v1.2.3