From eea2f45369f49d244e99257fcc71a9f367fdf0fd Mon Sep 17 00:00:00 2001 From: Leo Famulari Date: Sat, 8 Apr 2017 21:38:54 -0400 Subject: doc: Use OpenSSH instead of lsh in bare-bones template. * gnu/system/examples/bare-bones.tmpl (services): Use openssh-service-type instead of lsh-service. --- gnu/system/examples/bare-bones.tmpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/examples/bare-bones.tmpl b/gnu/system/examples/bare-bones.tmpl index 222ddda579..f7b8823d4f 100644 --- a/gnu/system/examples/bare-bones.tmpl +++ b/gnu/system/examples/bare-bones.tmpl @@ -43,5 +43,7 @@ ;; Add services to the baseline: a DHCP client and ;; an SSH server. (services (cons* (dhcp-client-service) - (lsh-service #:port-number 2222) + (service openssh-service-type + (openssh-configuration + (port-number 2222))) %base-services))) -- cgit v1.2.3 From c76b3046f651e8f46db1a093fdfc78cdc0bc3a13 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Sun, 2 Apr 2017 15:52:29 +0200 Subject: system: Rename operating-system-grub.cfg to operating-system-bootcfg. * gnu/system.scm (operating-system-grub.cfg): Rename to... (operating-system-bootcfg): ... this. * gnu/system/vm.scm (system-disk-image): Use operating-system-bootcfg. (system-qemu-image): Use operating-system-bootcfg. (system-qemu-image/shared-store): Use operating-system-bootcfg. * guix/scripts/system.scm (perform-action): Use operating-system-bootcfg. Signed-off-by: Danny Milosavljevic --- gnu/system/vm.scm | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 5c6e7f684a..ddb8981ec8 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -284,10 +284,10 @@ to USB sticks meant to be read-only." file-systems-to-keep))))) (mlet* %store-monad ((os-drv (operating-system-derivation os)) - (grub.cfg (operating-system-grub.cfg os))) + (bootcfg (operating-system-bootcfg os))) (qemu-image #:name name #:os-derivation os-drv - #:grub-configuration grub.cfg + #:grub-configuration bootcfg #:disk-image-size disk-image-size #:disk-image-format "raw" #:file-system-type file-system-type @@ -295,7 +295,7 @@ to USB sticks meant to be read-only." #:copy-inputs? #t #:register-closures? #t #:inputs `(("system" ,os-drv) - ("grub.cfg" ,grub.cfg)))))) + ("grub.cfg" ,bootcfg)))))) (define* (system-qemu-image os #:key @@ -328,13 +328,13 @@ of the GNU system as described by OS." file-systems-to-keep))))) (mlet* %store-monad ((os-drv (operating-system-derivation os)) - (grub.cfg (operating-system-grub.cfg os))) + (bootcfg (operating-system-bootcfg os))) (qemu-image #:os-derivation os-drv - #:grub-configuration grub.cfg + #:grub-configuration bootcfg #:disk-image-size disk-image-size #:file-system-type file-system-type #:inputs `(("system" ,os-drv) - ("grub.cfg" ,grub.cfg)) + ("grub.cfg" ,bootcfg)) #:copy-inputs? #t)))) @@ -423,16 +423,16 @@ When FULL-BOOT? is true, return an image that does a complete boot sequence, bootloaded included; thus, make a disk image that contains everything the bootloader refers to: OS kernel, initrd, bootloader data, etc." (mlet* %store-monad ((os-drv (operating-system-derivation os)) - (grub.cfg (operating-system-grub.cfg os))) + (bootcfg (operating-system-bootcfg os))) ;; XXX: When FULL-BOOT? is true, we end up creating an image that contains ;; GRUB.CFG and all its dependencies, including the output of OS-DRV. ;; This is more than needed (we only need the kernel, initrd, GRUB for its ;; font, and the background image), but it's hard to filter that. (qemu-image #:os-derivation os-drv - #:grub-configuration grub.cfg + #:grub-configuration bootcfg #:disk-image-size disk-image-size #:inputs (if full-boot? - `(("grub.cfg" ,grub.cfg)) + `(("grub.cfg" ,bootcfg)) '()) ;; XXX: Passing #t here is too slow, so let it off by default. -- cgit v1.2.3 From 07f812c404cd05dcac0d2801ad476f6e367ca6d4 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Sat, 15 Apr 2017 14:22:24 +0200 Subject: vm: Reword grub.cfg to bootcfg. * gnu/build/vm.scm (register-grub.cfg-root): Reword grub.cfg to bootcfg, (initialize-hard-disk): ditto, * gnu/system/vm.scm (system-disk-image): ditto, (system-qemu-image): ditto, (system-qemu-image/shared-store): ditto. Signed-off-by: Danny Milosavljevic --- gnu/system/vm.scm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index ddb8981ec8..374d8b6636 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès ;;; Copyright © 2016 Christopher Allan Webber ;;; Copyright © 2016 Leo Famulari +;;; Copyright © 2017 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. ;;; @@ -295,7 +296,7 @@ to USB sticks meant to be read-only." #:copy-inputs? #t #:register-closures? #t #:inputs `(("system" ,os-drv) - ("grub.cfg" ,bootcfg)))))) + ("bootcfg" ,bootcfg)))))) (define* (system-qemu-image os #:key @@ -334,7 +335,7 @@ of the GNU system as described by OS." #:disk-image-size disk-image-size #:file-system-type file-system-type #:inputs `(("system" ,os-drv) - ("grub.cfg" ,bootcfg)) + ("bootcfg" ,bootcfg)) #:copy-inputs? #t)))) @@ -425,14 +426,14 @@ bootloader refers to: OS kernel, initrd, bootloader data, etc." (mlet* %store-monad ((os-drv (operating-system-derivation os)) (bootcfg (operating-system-bootcfg os))) ;; XXX: When FULL-BOOT? is true, we end up creating an image that contains - ;; GRUB.CFG and all its dependencies, including the output of OS-DRV. + ;; BOOTCFG and all its dependencies, including the output of OS-DRV. ;; This is more than needed (we only need the kernel, initrd, GRUB for its ;; font, and the background image), but it's hard to filter that. (qemu-image #:os-derivation os-drv #:grub-configuration bootcfg #:disk-image-size disk-image-size #:inputs (if full-boot? - `(("grub.cfg" ,bootcfg)) + `(("bootcfg" ,bootcfg)) '()) ;; XXX: Passing #t here is too slow, so let it off by default. -- cgit v1.2.3 From 0ab1e8ae8892c92fd7a1fd07430ba6f2b710668d Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Sat, 15 Apr 2017 15:49:47 +0200 Subject: system: grub: Use (first all-entries) instead of (first entries). * gnu/system/grub.scm (grub-configuration-file): Use (first all-entries) instead of (first entries). --- gnu/system/grub.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm index 4f9bde6a62..bcfc3beae6 100644 --- a/gnu/system/grub.scm +++ b/gnu/system/grub.scm @@ -298,9 +298,9 @@ corresponding to old generations of the system." #$initrd))))) (mlet %store-monad ((sugar (eye-candy config - (menu-entry-device (first entries)) + (menu-entry-device (first all-entries)) (menu-entry-device-mount-point - (first entries)) + (first all-entries)) #:system system #:port #~port))) (define builder -- cgit v1.2.3 From 2e58e05bb68d4b747882cfa2b460b132d456f54a Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Sat, 15 Apr 2017 16:19:06 +0200 Subject: system: Pass boot-parameters to (gnu system grub). * gnu/system.scm (operating-system-bootcfg): Pass boot-parameters. * gnu/system/grub.scm (boot-parameters->menu-entry): New variable. (grub-configuration-file): Use boot-parameters->menu-entry. Signed-off-by: Danny Milosavljevic --- gnu/system/grub.scm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm index bcfc3beae6..f2838d633d 100644 --- a/gnu/system/grub.scm +++ b/gnu/system/grub.scm @@ -26,6 +26,7 @@ #:use-module (guix gexp) #:use-module (guix download) #:use-module (gnu artwork) + #:use-module (gnu system) #:use-module (gnu system file-systems) #:autoload (gnu packages bootloaders) (grub) #:autoload (gnu packages compression) (gzip) @@ -266,6 +267,15 @@ code." (#f #~(format #f "search --file --set ~a" #$file))))) +(define (boot-parameters->menu-entry conf) + (menu-entry + (label (boot-parameters-label conf)) + (device (boot-parameters-store-device conf)) + (device-mount-point (boot-parameters-store-mount-point conf)) + (linux (boot-parameters-kernel conf)) + (linux-arguments (boot-parameters-kernel-arguments conf)) + (initrd (boot-parameters-initrd conf)))) + (define* (grub-configuration-file config entries #:key (system (%current-system)) @@ -275,7 +285,8 @@ code." object. OLD-ENTRIES is taken to be a list of menu entries corresponding to old generations of the system." (define all-entries - (append entries (grub-configuration-menu-entries config))) + (append (map boot-parameters->menu-entry entries) + (grub-configuration-menu-entries config))) (define entry->gexp (match-lambda @@ -321,7 +332,7 @@ set timeout=~a~%" #$@(if (pair? old-entries) #~((format port " submenu \"GNU system, old configurations...\" {~%") - #$@(map entry->gexp old-entries) + #$@(map entry->gexp (map boot-parameters->menu-entry old-entries)) (format port "}~%")) #~())))) -- cgit v1.2.3 From 958a1fda9e0ad41468cbdb88766e7c854dd32df4 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Sat, 15 Apr 2017 22:02:38 +0200 Subject: system: Make grub use instead of again. * gnu/system/grub.scm: Remove boot-parameters->menu-entry. (grub-configuration): Don't use boot-parameters->menu-entry. * gnu/system.scm (operating-system-bootcfg): Use menu-entry. * guix/scripts/system.scm (reinstall-grub): Use profile-grub-entries. (perform-action): Use profile-grub-entries. --- gnu/system/grub.scm | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm index f2838d633d..cde4b9e23a 100644 --- a/gnu/system/grub.scm +++ b/gnu/system/grub.scm @@ -267,15 +267,6 @@ code." (#f #~(format #f "search --file --set ~a" #$file))))) -(define (boot-parameters->menu-entry conf) - (menu-entry - (label (boot-parameters-label conf)) - (device (boot-parameters-store-device conf)) - (device-mount-point (boot-parameters-store-mount-point conf)) - (linux (boot-parameters-kernel conf)) - (linux-arguments (boot-parameters-kernel-arguments conf)) - (initrd (boot-parameters-initrd conf)))) - (define* (grub-configuration-file config entries #:key (system (%current-system)) @@ -285,7 +276,7 @@ code." object. OLD-ENTRIES is taken to be a list of menu entries corresponding to old generations of the system." (define all-entries - (append (map boot-parameters->menu-entry entries) + (append entries (grub-configuration-menu-entries config))) (define entry->gexp @@ -332,7 +323,7 @@ set timeout=~a~%" #$@(if (pair? old-entries) #~((format port " submenu \"GNU system, old configurations...\" {~%") - #$@(map entry->gexp (map boot-parameters->menu-entry old-entries)) + #$@(map entry->gexp old-entries) (format port "}~%")) #~())))) -- cgit v1.2.3 From af98d25a1286e246e8da36d6d63b4d66e58f2cf8 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Fri, 21 Apr 2017 04:21:20 +0200 Subject: system: Rename operating-system-kernel-arguments to operating-system-user-kernel-arguments. * gnu/system.scm (operating-system-kernel-arguments): Rename to ... (operating-system-user-kernel-arguments): ... this. (): Adapt accordingly. (operating-system-bootcfg): Adapt accordingly. (operating-system-parameters-file): Adapt accordingly. * gnu/system/vm.scm (system-qemu-image/shared-store-script): Adapt accordingly. --- gnu/system/vm.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 374d8b6636..4f915c4f95 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -494,7 +494,7 @@ it is mostly useful when FULL-BOOT? is true." (string-append "--system=" #$os-drv) (string-append "--load=" #$os-drv "/boot") #$@(if graphic? #~() #~("console=ttyS0")) - #+@(operating-system-kernel-arguments os))) + #+@(operating-system-user-kernel-arguments os))) (define qemu-exec #~(list (string-append #$qemu "/bin/" #$(qemu-command (%current-system))) -- cgit v1.2.3 From 69daee23af49aeafcb1d250c90860f9253da719e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Wed, 3 May 2017 15:57:02 +0200 Subject: ui: Rename '_' to 'G_'. This avoids collisions with '_' when the latter is used as a 'match' pattern for instance. See . * guix/ui.scm: Rename '_' to 'G_'. * po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly. * build-aux/compile-all.scm (warnings): Remove 'format'. * gnu/packages.scm, gnu/services.scm, gnu/services/shepherd.scm, gnu/system.scm, gnu/system/shadow.scm, guix/gnupg.scm, guix/http-client.scm, guix/import/cpan.scm, guix/import/elpa.scm, guix/import/pypi.scm, guix/nar.scm, guix/scripts.scm, guix/scripts/archive.scm, guix/scripts/authenticate.scm, guix/scripts/build.scm, guix/scripts/challenge.scm, guix/scripts/container.scm, guix/scripts/container/exec.scm, guix/scripts/copy.scm, guix/scripts/download.scm, guix/scripts/edit.scm, guix/scripts/environment.scm, guix/scripts/gc.scm, guix/scripts/graph.scm, guix/scripts/hash.scm, guix/scripts/import.scm, guix/scripts/import/cpan.scm, guix/scripts/import/cran.scm, guix/scripts/import/crate.scm, guix/scripts/import/elpa.scm, guix/scripts/import/gem.scm, guix/scripts/import/gnu.scm, guix/scripts/import/hackage.scm, guix/scripts/import/nix.scm, guix/scripts/import/pypi.scm, guix/scripts/import/stackage.scm, guix/scripts/lint.scm, guix/scripts/offload.scm, guix/scripts/pack.scm, guix/scripts/package.scm, guix/scripts/perform-download.scm, guix/scripts/publish.scm, guix/scripts/pull.scm, guix/scripts/refresh.scm, guix/scripts/size.scm, guix/scripts/substitute.scm, guix/scripts/system.scm, guix/ssh.scm, guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`". --- gnu/system/shadow.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index 1acfcc4866..b30ef8e390 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -220,7 +220,7 @@ set debug-file-directory ~/.guix-profile/lib/debug\n"))) (raise (condition (&message (message - (format #f (_ "supplementary group '~a' \ + (format #f (G_ "supplementary group '~a' \ of user '~a' is undeclared") group (user-account-name user)))))))) @@ -230,7 +230,7 @@ of user '~a' is undeclared") (raise (condition (&message (message - (format #f (_ "primary group '~a' \ + (format #f (G_ "primary group '~a' \ of user '~a' is undeclared") (user-account-group user) (user-account-name user))))))) -- cgit v1.2.3 From 83071b052a0585f7166245b7ba793436e104f8fe Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Fri, 21 Apr 2017 14:37:11 +0200 Subject: system: vm: Use operating-system-kernel-arguments. * gnu/system/vm.scm (system-qemu-image/shared-store-script): Use operating-system-kernel-arguments. --- gnu/system/vm.scm | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 4f915c4f95..2c8b954c80 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -490,11 +490,8 @@ it is mostly useful when FULL-BOOT? is true." #:full-boot? full-boot? #:disk-image-size disk-image-size))) (define kernel-arguments - #~(list "--root=/dev/vda1" - (string-append "--system=" #$os-drv) - (string-append "--load=" #$os-drv "/boot") - #$@(if graphic? #~() #~("console=ttyS0")) - #+@(operating-system-user-kernel-arguments os))) + #~(list #$@(if graphic? #~() #~("console=ttyS0")) + #+@(operating-system-kernel-arguments os os-drv "/dev/vda1"))) (define qemu-exec #~(list (string-append #$qemu "/bin/" #$(qemu-command (%current-system))) -- cgit v1.2.3 From bf8b09169c7d8ae48ac99ea237b82867ee9aa885 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Fri, 21 Apr 2017 14:37:13 +0200 Subject: system: grub: Use boot-parameters instead of menu-entry where possible. * gnu/system/grub.scm (boot-parameters->menu-entry): New variable. (grub-configuration-file): Use boot-parameters instead of menu-entry where possible. * guix/scripts/system.scm (profile-boot-parameters): Update docstring. (reinstall-grub): Use profile-boot-parameters. (perform-action): Use profile-boot-parameters. --- gnu/system/grub.scm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm index cde4b9e23a..d2fa984ec7 100644 --- a/gnu/system/grub.scm +++ b/gnu/system/grub.scm @@ -267,6 +267,16 @@ code." (#f #~(format #f "search --file --set ~a" #$file))))) +(define (boot-parameters->menu-entry conf) + "Convert a instance to a corresponding ." + (menu-entry + (label (boot-parameters-label conf)) + (device (boot-parameters-store-device conf)) + (device-mount-point (boot-parameters-store-mount-point conf)) + (linux (boot-parameters-kernel conf)) + (linux-arguments (boot-parameters-kernel-arguments conf)) + (initrd (boot-parameters-initrd conf)))) + (define* (grub-configuration-file config entries #:key (system (%current-system)) @@ -276,7 +286,7 @@ code." object. OLD-ENTRIES is taken to be a list of menu entries corresponding to old generations of the system." (define all-entries - (append entries + (append (map boot-parameters->menu-entry entries) (grub-configuration-menu-entries config))) (define entry->gexp @@ -323,7 +333,7 @@ set timeout=~a~%" #$@(if (pair? old-entries) #~((format port " submenu \"GNU system, old configurations...\" {~%") - #$@(map entry->gexp old-entries) + #$@(map entry->gexp (map boot-parameters->menu-entry old-entries)) (format port "}~%")) #~())))) -- cgit v1.2.3 From e586257b550918fefaab3970f2c314d6285f54ab Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 8 May 2017 12:21:02 +0200 Subject: system: Allow root to run "su" without password. * gnu/system/pam.scm (unix-pam-service): Add pam-entry for "pam_rootok.so" to auth field when ALLOW-ROOT? is #T. (base-pam-services): Allow root to run "su" without authentication. --- gnu/system/pam.scm | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/pam.scm b/gnu/system/pam.scm index 4546c1a73a..eedf933946 100644 --- a/gnu/system/pam.scm +++ b/gnu/system/pam.scm @@ -204,21 +204,27 @@ dumped in /etc/pam.d/NAME, where NAME is the name of SERVICE." (env (pam-entry ; to honor /etc/environment. (control "required") (module "pam_env.so")))) - (lambda* (name #:key allow-empty-passwords? motd) + (lambda* (name #:key allow-empty-passwords? (allow-root? #f) motd) "Return a standard Unix-style PAM service for NAME. When -ALLOW-EMPTY-PASSWORDS? is true, allow empty passwords. When MOTD is true, it -should be a file-like object used as the message-of-the-day." +ALLOW-EMPTY-PASSWORDS? is true, allow empty passwords. When ALLOW-ROOT? is +true, allow root to run the command without authentication. When MOTD is +true, it should be a file-like object used as the message-of-the-day." ;; See . (let ((name* name)) (pam-service (name name*) (account (list unix)) - (auth (list (if allow-empty-passwords? - (pam-entry - (control "required") - (module "pam_unix.so") - (arguments '("nullok"))) - unix))) + (auth (append (if allow-root? + (list (pam-entry + (control "sufficient") + (module "pam_rootok.so"))) + '()) + (list (if allow-empty-passwords? + (pam-entry + (control "required") + (module "pam_unix.so") + (arguments '("nullok"))) + unix)))) (password (list (pam-entry (control "required") (module "pam_unix.so") @@ -256,7 +262,12 @@ authenticate to run COMMAND." ;; These programs are setuid-root. (map (cut unix-pam-service <> #:allow-empty-passwords? allow-empty-passwords?) - '("su" "passwd" "sudo")) + '("passwd" "sudo")) + ;; This is setuid-root, as well. Allow root to run "su" without + ;; authenticating. + (list (unix-pam-service "su" + #:allow-empty-passwords? allow-empty-passwords? + #:allow-root? #t)) ;; These programs are not setuid-root, and we want root to be able ;; to run them without having to authenticate (notably because -- cgit v1.2.3 From 76f429ad9b669a0c72faf16b0be158ab040d4da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 8 May 2017 17:20:12 +0200 Subject: system: grub: Use the native Guile-Cairo and Guile-SVG. * gnu/system/grub.scm (svg->png): Use 'ungexp-native' aka. #+ when referring to GUILE-CAIRO, GUILE-SVG, and SVG. --- gnu/system/grub.scm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm index d2fa984ec7..58096429fe 100644 --- a/gnu/system/grub.scm +++ b/gnu/system/grub.scm @@ -144,15 +144,15 @@ denoting a file name." (with-imported-modules '((gnu build svg)) #~(begin ;; We need these two libraries. - (add-to-load-path (string-append #$guile-rsvg + (add-to-load-path (string-append #+guile-rsvg "/share/guile/site/" (effective-version))) - (add-to-load-path (string-append #$guile-cairo + (add-to-load-path (string-append #+guile-cairo "/share/guile/site/" (effective-version))) (use-modules (gnu build svg)) - (svg->png #$svg #$output + (svg->png #+svg #$output #:width #$width #:height #$height))))) -- cgit v1.2.3 From e0b2e93005188ab4d6c7413a27832ba2fb7388e8 Mon Sep 17 00:00:00 2001 From: Leo Famulari Date: Thu, 11 May 2017 03:12:44 -0400 Subject: system: grub: Expose GRUB's interactive interface settings. * gnu/system/grub.scm (): Add new fields terminal-outputs, terminal-inputs, serial-unit, and serial-speed. (grub-setup-io, setup-gfxterm): New procedures. * doc/guix.texi (GRUB Configuration): Document the new fields. --- gnu/system/grub.scm | 99 ++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 82 insertions(+), 17 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm index 58096429fe..97081d8485 100644 --- a/gnu/system/grub.scm +++ b/gnu/system/grub.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès ;;; Copyright © 2016 Chris Marusich +;;; Copyright © 2017 Leo Famulari ;;; ;;; This file is part of GNU Guix. ;;; @@ -108,17 +109,25 @@ denoting a file name." (define-record-type* grub-configuration make-grub-configuration grub-configuration? - (grub grub-configuration-grub ; package - (default (@ (gnu packages bootloaders) grub))) - (device grub-configuration-device) ; string - (menu-entries grub-configuration-menu-entries ; list - (default '())) - (default-entry grub-configuration-default-entry ; integer - (default 0)) - (timeout grub-configuration-timeout ; integer - (default 5)) - (theme grub-configuration-theme ; - (default %default-theme))) + (grub grub-configuration-grub ; package + (default (@ (gnu packages bootloaders) grub))) + (device grub-configuration-device) ; string + (menu-entries grub-configuration-menu-entries ; list + (default '())) + (default-entry grub-configuration-default-entry ; integer + (default 0)) + (timeout grub-configuration-timeout ; integer + (default 5)) + (theme grub-configuration-theme ; + (default %default-theme)) + (terminal-outputs grub-configuration-terminal-outputs ; list of symbols + (default '(gfxterm))) + (terminal-inputs grub-configuration-terminal-inputs ; list of symbols + (default '())) + (serial-unit grub-configuration-serial-unit ; integer | #f + (default #f)) + (serial-speed grub-configuration-serial-speed ; integer | #f + (default #f))) (define-record-type* menu-entry make-menu-entry @@ -199,11 +208,16 @@ system string---e.g., \"x86_64-linux\"." insmod vbe insmod vga fi - - terminal_output gfxterm " "")) + (define (setup-gfxterm config font-file) + (if (memq 'gfxterm (grub-configuration-terminal-outputs config)) + #~(format #f "if loadfont ~a; then + setup_gfxterm +fi~%" #$font-file) + "")) + (define (theme-colors type) (let* ((theme (grub-configuration-theme config)) (colors (type theme))) @@ -222,9 +236,8 @@ function setup_gfxterm {~a} # Set 'root' to the partition that contains /gnu/store. ~a -if loadfont ~a; then - setup_gfxterm -fi +~a +~a insmod png if background_image ~a; then @@ -236,7 +249,8 @@ else fi~%" #$setup-gfxterm-body #$(grub-root-search store-device font-file) - #$font-file + #$(grub-setup-io config) + #$(setup-gfxterm config font-file) #$(strip-mount-point store-mount-point image) #$(theme-colors grub-theme-color-normal) @@ -247,6 +261,57 @@ fi~%" ;;; Configuration file. ;;; +(define (grub-setup-io config) + "Return GRUB commands to configure the input / output interfaces. The result +is a string that can be inserted in grub.cfg." + (let* ((symbols->string (lambda (list) + (string-join (map symbol->string list) " "))) + (outputs (grub-configuration-terminal-outputs config)) + (inputs (grub-configuration-terminal-inputs config)) + (unit (grub-configuration-serial-unit config)) + (speed (grub-configuration-serial-speed config)) + + ;; Respectively, GRUB_TERMINAL_OUTPUT and GRUB_TERMINAL_INPUT, + ;; as documented in GRUB manual section "Simple Configuration + ;; Handling". + (valid-outputs '(console serial serial_0 serial_1 serial_2 serial_3 + gfxterm vga_text mda_text morse spkmodem)) + (valid-inputs '(console serial serial_0 serial_1 serial_2 serial_3 + at_keyboard usb_keyboard)) + + (io (string-append + "terminal_output " + (symbols->string + (map + (lambda (output) + (if (memq output valid-outputs) output #f)) outputs)) "\n" + (if (null? inputs) + "" + (string-append + "terminal_input " + (symbols->string + (map + (lambda (input) + (if (memq input valid-inputs) input #f)) inputs)) "\n")) + ;; UNIT and SPEED are arguments to the same GRUB command + ;; ("serial"), so we process them together. + (if (or unit speed) + (string-append + "serial" + (if unit + ;; COM ports 1 through 4 + (if (and (exact-integer? unit) (<= unit 3) (>= unit 0)) + (string-append " --unit=" (number->string unit)) + #f) + "") + (if speed + (if (exact-integer? speed) + (string-append " --speed=" (number->string speed)) + #f) + "")) + "")))) + (format #f "~a" io))) + (define (grub-root-search device file) "Return the GRUB 'search' command to look for DEVICE, which contains FILE, a gexp. The result is a gexp that can be inserted in the grub.cfg-generation -- cgit v1.2.3 From c48a145fbb613ac2b623f0a11278848923b312f1 Mon Sep 17 00:00:00 2001 From: Leo Famulari Date: Mon, 15 May 2017 15:32:25 -0400 Subject: system: grub: Actually default to 'gfxterm' for displaying the GRUB menu. This is a followup to commit e0b2e93005188ab4d6c7413a27832ba2fb7388e8. * gnu/system/grub.scm (eye-candy): Re-order the elements of the generated GRUB configuration. --- gnu/system/grub.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm index 97081d8485..85878de85c 100644 --- a/gnu/system/grub.scm +++ b/gnu/system/grub.scm @@ -249,8 +249,8 @@ else fi~%" #$setup-gfxterm-body #$(grub-root-search store-device font-file) - #$(grub-setup-io config) #$(setup-gfxterm config font-file) + #$(grub-setup-io config) #$(strip-mount-point store-mount-point image) #$(theme-colors grub-theme-color-normal) -- cgit v1.2.3 From b09a8da4a2e50845a297e041762f3ff9e649c047 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Mon, 15 May 2017 22:24:18 +0200 Subject: bootloader: Add extlinux support. * gnu/bootloader.scm: New file. * gnu/bootloader/extlinux.scm: New file. * gnu/bootloader/grub.scm: New file. * gnu/local.mk: Build new files. * gnu/system.scm: Adapt to new bootloader api. * gnu/scripts/system.scm: Adapt to new bootloader api. * gnu.scm: Remove (gnu system grub) and replace by (gnu bootloader) and (gnu bootloader grub) modules. * gnu/system/grub.scm: Moved content to gnu/bootloader/grub.scm. * gnu/system/vm: Replace (gnu system grub) module by (gnu bootloader). * gnu/tests.scm: Ditto. * gnu/tests/nfs.scm: Ditto. --- gnu/system/grub.scm | 407 ---------------------------------------------------- gnu/system/vm.scm | 2 +- 2 files changed, 1 insertion(+), 408 deletions(-) delete mode 100644 gnu/system/grub.scm (limited to 'gnu/system') diff --git a/gnu/system/grub.scm b/gnu/system/grub.scm deleted file mode 100644 index 85878de85c..0000000000 --- a/gnu/system/grub.scm +++ /dev/null @@ -1,407 +0,0 @@ -;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2017 Ludovic Courtès -;;; Copyright © 2016 Chris Marusich -;;; Copyright © 2017 Leo Famulari -;;; -;;; This file is part of GNU Guix. -;;; -;;; GNU Guix is free software; you can redistribute it and/or modify it -;;; under the terms of the GNU General Public License as published by -;;; the Free Software Foundation; either version 3 of the License, or (at -;;; your option) any later version. -;;; -;;; GNU Guix is distributed in the hope that it will be useful, but -;;; WITHOUT ANY WARRANTY; without even the implied warranty of -;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -;;; GNU General Public License for more details. -;;; -;;; You should have received a copy of the GNU General Public License -;;; along with GNU Guix. If not, see . - -(define-module (gnu system grub) - #:use-module (guix store) - #:use-module (guix packages) - #:use-module (guix derivations) - #:use-module (guix records) - #:use-module (guix monads) - #:use-module (guix gexp) - #:use-module (guix download) - #:use-module (gnu artwork) - #:use-module (gnu system) - #:use-module (gnu system file-systems) - #:autoload (gnu packages bootloaders) (grub) - #:autoload (gnu packages compression) (gzip) - #:autoload (gnu packages gtk) (guile-cairo guile-rsvg) - #:use-module (ice-9 match) - #:use-module (ice-9 regex) - #:use-module (srfi srfi-1) - #:use-module (rnrs bytevectors) - #:export (grub-image - grub-image? - grub-image-aspect-ratio - grub-image-file - - grub-theme - grub-theme? - grub-theme-images - grub-theme-color-normal - grub-theme-color-highlight - - %background-image - %default-theme - - grub-configuration - grub-configuration? - grub-configuration-device - grub-configuration-grub - - menu-entry - menu-entry? - - grub-configuration-file)) - -;;; Commentary: -;;; -;;; Configuration of GNU GRUB. -;;; -;;; Code: - -(define (strip-mount-point mount-point file) - "Strip MOUNT-POINT from FILE, which is a gexp or other lowerable object -denoting a file name." - (if (string=? mount-point "/") - file - #~(let ((file #$file)) - (if (string-prefix? #$mount-point file) - (substring #$file #$(string-length mount-point)) - file)))) - -(define-record-type* - grub-image make-grub-image - grub-image? - (aspect-ratio grub-image-aspect-ratio ;rational number - (default 4/3)) - (file grub-image-file)) ;file-valued gexp (SVG) - -(define-record-type* - grub-theme make-grub-theme - grub-theme? - (images grub-theme-images - (default '())) ;list of - (color-normal grub-theme-color-normal - (default '((fg . cyan) (bg . blue)))) - (color-highlight grub-theme-color-highlight - (default '((fg . white) (bg . blue))))) - -(define %background-image - (grub-image - (aspect-ratio 4/3) - (file (file-append %artwork-repository - "/grub/GuixSD-fully-black-4-3.svg")))) - -(define %default-theme - ;; Default theme contributed by Felipe López. - (grub-theme - (images (list %background-image)) - (color-highlight '((fg . yellow) (bg . black))) - (color-normal '((fg . light-gray) (bg . black))))) ;XXX: #x303030 - -(define-record-type* - grub-configuration make-grub-configuration - grub-configuration? - (grub grub-configuration-grub ; package - (default (@ (gnu packages bootloaders) grub))) - (device grub-configuration-device) ; string - (menu-entries grub-configuration-menu-entries ; list - (default '())) - (default-entry grub-configuration-default-entry ; integer - (default 0)) - (timeout grub-configuration-timeout ; integer - (default 5)) - (theme grub-configuration-theme ; - (default %default-theme)) - (terminal-outputs grub-configuration-terminal-outputs ; list of symbols - (default '(gfxterm))) - (terminal-inputs grub-configuration-terminal-inputs ; list of symbols - (default '())) - (serial-unit grub-configuration-serial-unit ; integer | #f - (default #f)) - (serial-speed grub-configuration-serial-speed ; integer | #f - (default #f))) - -(define-record-type* - menu-entry make-menu-entry - menu-entry? - (label menu-entry-label) - (device menu-entry-device ; file system uuid, label, or #f - (default #f)) - (device-mount-point menu-entry-device-mount-point - (default "/")) - (linux menu-entry-linux) - (linux-arguments menu-entry-linux-arguments - (default '())) ; list of string-valued gexps - (initrd menu-entry-initrd)) ; file name of the initrd as a gexp - - -;;; -;;; Background image & themes. -;;; - -(define* (svg->png svg #:key width height) - "Build a PNG of HEIGHT x WIDTH from SVG." - (gexp->derivation "grub-image.png" - (with-imported-modules '((gnu build svg)) - #~(begin - ;; We need these two libraries. - (add-to-load-path (string-append #+guile-rsvg - "/share/guile/site/" - (effective-version))) - (add-to-load-path (string-append #+guile-cairo - "/share/guile/site/" - (effective-version))) - - (use-modules (gnu build svg)) - (svg->png #+svg #$output - #:width #$width - #:height #$height))))) - -(define* (grub-background-image config #:key (width 1024) (height 768)) - "Return the GRUB background image defined in CONFIG with a ratio of -WIDTH/HEIGHT, or #f if none was found." - (let* ((ratio (/ width height)) - (image (find (lambda (image) - (= (grub-image-aspect-ratio image) ratio)) - (grub-theme-images (grub-configuration-theme config))))) - (if image - (svg->png (grub-image-file image) - #:width width #:height height) - (with-monad %store-monad - (return #f))))) - -(define* (eye-candy config store-device store-mount-point - #:key system port) - "Return in %STORE-MONAD a gexp that writes to PORT (a port-valued gexp) the -'grub.cfg' part concerned with graphics mode, background images, colors, and -all that. STORE-DEVICE designates the device holding the store, and -STORE-MOUNT-POINT is its mount point; these are used to determine where the -background image and fonts must be searched for. SYSTEM must be the target -system string---e.g., \"x86_64-linux\"." - (define setup-gfxterm-body - ;; Intel and EFI systems need to be switched into graphics mode, whereas - ;; most other modern architectures have no other mode and therefore don't - ;; need to be switched. - (if (string-match "^(x86_64|i[3-6]86)-" system) - " - # Leave 'gfxmode' to 'auto'. - insmod video_bochs - insmod video_cirrus - insmod gfxterm - - if [ \"${grub_platform}\" == efi ]; then - # This is for (U)EFI systems (these modules are unavailable in the - # non-EFI GRUB.) If we don't load them, GRUB boots in \"blind mode\", - # which isn't convenient. - insmod efi_gop - insmod efi_uga - else - # These are specific to non-EFI Intel machines. - insmod vbe - insmod vga - fi -" - "")) - - (define (setup-gfxterm config font-file) - (if (memq 'gfxterm (grub-configuration-terminal-outputs config)) - #~(format #f "if loadfont ~a; then - setup_gfxterm -fi~%" #$font-file) - "")) - - (define (theme-colors type) - (let* ((theme (grub-configuration-theme config)) - (colors (type theme))) - (string-append (symbol->string (assoc-ref colors 'fg)) "/" - (symbol->string (assoc-ref colors 'bg))))) - - (define font-file - (strip-mount-point store-mount-point - (file-append grub "/share/grub/unicode.pf2"))) - - (mlet* %store-monad ((image (grub-background-image config))) - (return (and image - #~(format #$port " -function setup_gfxterm {~a} - -# Set 'root' to the partition that contains /gnu/store. -~a - -~a -~a - -insmod png -if background_image ~a; then - set color_normal=~a - set color_highlight=~a -else - set menu_color_normal=cyan/blue - set menu_color_highlight=white/blue -fi~%" - #$setup-gfxterm-body - #$(grub-root-search store-device font-file) - #$(setup-gfxterm config font-file) - #$(grub-setup-io config) - - #$(strip-mount-point store-mount-point image) - #$(theme-colors grub-theme-color-normal) - #$(theme-colors grub-theme-color-highlight)))))) - - -;;; -;;; Configuration file. -;;; - -(define (grub-setup-io config) - "Return GRUB commands to configure the input / output interfaces. The result -is a string that can be inserted in grub.cfg." - (let* ((symbols->string (lambda (list) - (string-join (map symbol->string list) " "))) - (outputs (grub-configuration-terminal-outputs config)) - (inputs (grub-configuration-terminal-inputs config)) - (unit (grub-configuration-serial-unit config)) - (speed (grub-configuration-serial-speed config)) - - ;; Respectively, GRUB_TERMINAL_OUTPUT and GRUB_TERMINAL_INPUT, - ;; as documented in GRUB manual section "Simple Configuration - ;; Handling". - (valid-outputs '(console serial serial_0 serial_1 serial_2 serial_3 - gfxterm vga_text mda_text morse spkmodem)) - (valid-inputs '(console serial serial_0 serial_1 serial_2 serial_3 - at_keyboard usb_keyboard)) - - (io (string-append - "terminal_output " - (symbols->string - (map - (lambda (output) - (if (memq output valid-outputs) output #f)) outputs)) "\n" - (if (null? inputs) - "" - (string-append - "terminal_input " - (symbols->string - (map - (lambda (input) - (if (memq input valid-inputs) input #f)) inputs)) "\n")) - ;; UNIT and SPEED are arguments to the same GRUB command - ;; ("serial"), so we process them together. - (if (or unit speed) - (string-append - "serial" - (if unit - ;; COM ports 1 through 4 - (if (and (exact-integer? unit) (<= unit 3) (>= unit 0)) - (string-append " --unit=" (number->string unit)) - #f) - "") - (if speed - (if (exact-integer? speed) - (string-append " --speed=" (number->string speed)) - #f) - "")) - "")))) - (format #f "~a" io))) - -(define (grub-root-search device file) - "Return the GRUB 'search' command to look for DEVICE, which contains FILE, -a gexp. The result is a gexp that can be inserted in the grub.cfg-generation -code." - ;; Usually FILE is a file name gexp like "/gnu/store/…-linux/vmlinuz", but - ;; it can also be something like "(hd0,msdos1)/vmlinuz" in the case of - ;; custom menu entries. In the latter case, don't emit a 'search' command. - (if (and (string? file) (not (string-prefix? "/" file))) - "" - (match device - ;; Preferably refer to DEVICE by its UUID or label. This is more - ;; efficient and less ambiguous, see . - ((? bytevector? uuid) - (format #f "search --fs-uuid --set ~a" - (uuid->string device))) - ((? string? label) - (format #f "search --label --set ~a" label)) - (#f - #~(format #f "search --file --set ~a" #$file))))) - -(define (boot-parameters->menu-entry conf) - "Convert a instance to a corresponding ." - (menu-entry - (label (boot-parameters-label conf)) - (device (boot-parameters-store-device conf)) - (device-mount-point (boot-parameters-store-mount-point conf)) - (linux (boot-parameters-kernel conf)) - (linux-arguments (boot-parameters-kernel-arguments conf)) - (initrd (boot-parameters-initrd conf)))) - -(define* (grub-configuration-file config entries - #:key - (system (%current-system)) - (old-entries '())) - "Return the GRUB configuration file corresponding to CONFIG, a - object, and where the store is available at STORE-FS, a - object. OLD-ENTRIES is taken to be a list of menu entries -corresponding to old generations of the system." - (define all-entries - (append (map boot-parameters->menu-entry entries) - (grub-configuration-menu-entries config))) - - (define entry->gexp - (match-lambda - (($ label device device-mount-point - linux arguments initrd) - ;; Here DEVICE is the store and DEVICE-MOUNT-POINT is its mount point. - ;; Use the right file names for LINUX and INITRD in case - ;; DEVICE-MOUNT-POINT is not "/", meaning that the store is on a - ;; separate partition. - (let ((linux (strip-mount-point device-mount-point linux)) - (initrd (strip-mount-point device-mount-point initrd))) - #~(format port "menuentry ~s { - ~a - linux ~a ~a - initrd ~a -}~%" - #$label - #$(grub-root-search device linux) - #$linux (string-join (list #$@arguments)) - #$initrd))))) - - (mlet %store-monad ((sugar (eye-candy config - (menu-entry-device (first all-entries)) - (menu-entry-device-mount-point - (first all-entries)) - #:system system - #:port #~port))) - (define builder - #~(call-with-output-file #$output - (lambda (port) - (format port - "# This file was generated from your GuixSD configuration. Any changes -# will be lost upon reconfiguration. -") - #$sugar - (format port " -set default=~a -set timeout=~a~%" - #$(grub-configuration-default-entry config) - #$(grub-configuration-timeout config)) - #$@(map entry->gexp all-entries) - - #$@(if (pair? old-entries) - #~((format port " -submenu \"GNU system, old configurations...\" {~%") - #$@(map entry->gexp (map boot-parameters->menu-entry old-entries)) - (format port "}~%")) - #~())))) - - (gexp->derivation "grub.cfg" builder))) - -;;; grub.scm ends here diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 2c8b954c80..080014cde4 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -49,7 +49,7 @@ #:use-module (gnu system shadow) #:use-module (gnu system pam) #:use-module (gnu system linux-initrd) - #:use-module (gnu system grub) + #:use-module (gnu bootloader) #:use-module (gnu system file-systems) #:use-module (gnu system) #:use-module (gnu services) -- cgit v1.2.3 From 9121ce553d267e9fdd4c6b9a268ce9d8677dd234 Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Tue, 9 May 2017 10:52:02 +0200 Subject: bootloader: Adapt vm to new bootloader API. * gnu/build/install.scm (install-boot-config): New procedure. (install-grub): Move to (gnu bootloader grub). * gnu/build/vm.scm (register-bootcfg-root): Rename register-grub.cfg-root and adjust accordingly. (initialize-hard-disk): Takes a bootloader-package, bootcfg, bootcfg-location and bootloader-installer procedure. Adjust accordingly. * gnu/system/vm.scm (qemu-image): Adjust to initialize-hard-disk. (system-disk-image, system-qemu-image, system-qemu-image/shared-store): Adjust to qemu-image. --- gnu/system/vm.scm | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 080014cde4..2ee5c2b1e7 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -46,6 +46,7 @@ #:select (%guile-static-stripped)) #:use-module (gnu packages admin) + #:use-module (gnu bootloader) #:use-module (gnu system shadow) #:use-module (gnu system pam) #:use-module (gnu system linux-initrd) @@ -176,8 +177,9 @@ made available under the /xchg CIFS share." (disk-image-format "qcow2") (file-system-type "ext4") file-system-label - os-derivation - grub-configuration + os-drv + bootcfg-drv + bootloader (register-closures? #t) (inputs '()) copy-inputs?) @@ -201,7 +203,7 @@ the image." (guix build utils)) (let ((inputs - '#$(append (list qemu parted grub e2fsprogs) + '#$(append (list qemu parted e2fsprogs) (map canonical-package (list sed grep coreutils findutils gawk)) (if register-closures? (list guix) '()))) @@ -223,7 +225,7 @@ the image." #:closures graphs #:copy-closures? #$copy-inputs? #:register-closures? #$register-closures? - #:system-directory #$os-derivation)) + #:system-directory #$os-drv)) (partitions (list (partition (size #$(- disk-image-size (* 10 (expt 2 20)))) @@ -233,7 +235,13 @@ the image." (initializer initialize))))) (initialize-hard-disk "/dev/vda" #:partitions partitions - #:grub.cfg #$grub-configuration) + #:bootloader-package + #$(bootloader-package bootloader) + #:bootcfg #$bootcfg-drv + #:bootcfg-location + #$(bootloader-configuration-file bootloader) + #:bootloader-installer + #$(bootloader-installer bootloader)) (reboot))))) #:system system #:make-disk-image? #t @@ -287,8 +295,10 @@ to USB sticks meant to be read-only." (mlet* %store-monad ((os-drv (operating-system-derivation os)) (bootcfg (operating-system-bootcfg os))) (qemu-image #:name name - #:os-derivation os-drv - #:grub-configuration bootcfg + #:os-drv os-drv + #:bootcfg-drv bootcfg + #:bootloader (bootloader-configuration-bootloader + (operating-system-bootloader os)) #:disk-image-size disk-image-size #:disk-image-format "raw" #:file-system-type file-system-type @@ -330,8 +340,10 @@ of the GNU system as described by OS." (mlet* %store-monad ((os-drv (operating-system-derivation os)) (bootcfg (operating-system-bootcfg os))) - (qemu-image #:os-derivation os-drv - #:grub-configuration bootcfg + (qemu-image #:os-drv os-drv + #:bootcfg-drv bootcfg + #:bootloader (bootloader-configuration-bootloader + (operating-system-bootloader os)) #:disk-image-size disk-image-size #:file-system-type file-system-type #:inputs `(("system" ,os-drv) @@ -429,8 +441,10 @@ bootloader refers to: OS kernel, initrd, bootloader data, etc." ;; BOOTCFG and all its dependencies, including the output of OS-DRV. ;; This is more than needed (we only need the kernel, initrd, GRUB for its ;; font, and the background image), but it's hard to filter that. - (qemu-image #:os-derivation os-drv - #:grub-configuration bootcfg + (qemu-image #:os-drv os-drv + #:bootcfg-drv bootcfg + #:bootloader (bootloader-configuration-bootloader + (operating-system-bootloader os)) #:disk-image-size disk-image-size #:inputs (if full-boot? `(("bootcfg" ,bootcfg)) -- cgit v1.2.3 From 4b236c88eaa690a045bc57b9c4d2acf44ae91f17 Mon Sep 17 00:00:00 2001 From: Leo Famulari Date: Sat, 13 May 2017 20:44:36 -0400 Subject: maint: The 'release' target builds a VM image. * gnu/system/examples/vm-image.tmpl: New file. * Makefile.am (GUIXSD_VM_SYSTEMS, GUIXSD_VM_IMAGE_BASE, GUIXSD_VM_IMAGE_SIZE): New variables. (release): Add logic to build a VM image. (EXAMPLES): Add 'gnu/system/examples/vm-image.tmpl'. * doc/guix.texi (Running GuixSD in a VM, Installing GuixSD in a VM): Mention the pre-built VM image. --- gnu/system/examples/vm-image.tmpl | 53 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 gnu/system/examples/vm-image.tmpl (limited to 'gnu/system') diff --git a/gnu/system/examples/vm-image.tmpl b/gnu/system/examples/vm-image.tmpl new file mode 100644 index 0000000000..57ac71c535 --- /dev/null +++ b/gnu/system/examples/vm-image.tmpl @@ -0,0 +1,53 @@ +;;; This is an operating system configuration template for a "bare-bones" setup, +;;; suitable for booting in a virtualized environment, including virtual private +;;; servers (VPS). + +(use-modules (gnu)) +(use-package-modules bootloaders disk nvi) + +(define vm-image-motd (plain-file "motd" " +This is the GNU system. Welcome! + +This instance of GuixSD is a bare-bones template for virtualized environments. + +You will probably want to do these things first if you booted in a virtual +private server (VPS): + +* Set a password for 'root'. +* Set up networking. +* Expand the root partition to fill the space available by 0) deleting and +recreating the partition with fdisk, 1) reloading the partition table with +partprobe, and then 2) resizing the filesystem with resize2fs.\n")) + +(operating-system + (host-name "gnu") + (timezone "Etc/UTC") + (locale "en_US.utf8") + + ;; Assuming /dev/sdX is the target hard disk, and "my-root" is + ;; the label of the target root file system. + (bootloader (grub-configuration (device "/dev/sda") + (terminal-outputs '(console)))) + (file-systems (cons (file-system + (device "my-root") + (title 'label) + (mount-point "/") + (type "ext4")) + %base-file-systems)) + + ;; This is where user accounts are specified. The "root" + ;; account is implicit, and is initially created with the + ;; empty password. + (users %base-user-accounts) + + ;; Globally-installed packages. + (packages (cons* nvi fdisk + grub ; mostly so xrefs to its manual work + parted ; partprobe + %base-packages)) + + (services (modify-services %base-services + (login-service-type config => + (login-configuration + (inherit config) + (motd vm-image-motd)))))) -- cgit v1.2.3 From c80cd4dfb4da1cc9d0ace233513bee0497db8a74 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Mon, 17 Apr 2017 22:49:23 +0200 Subject: install: Enable SSH in installation image. * gnu/system/install.scm (%installation-services): Add OPENSSH-SERVICE-TYPE. * doc/guix.texi (Preparing for Installation)[Networking]: Document it. --- gnu/system/install.scm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gnu/system') diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 191ccf1680..9a6febfeba 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2014, 2015, 2016, 2017 Ludovic Courtès ;;; Copyright © 2015 Mark H Weaver ;;; Copyright © 2016 Andreas Enge +;;; Copyright © 2017 Marius Bakke ;;; ;;; This file is part of GNU Guix. ;;; @@ -25,6 +26,7 @@ #:use-module (guix monads) #:use-module ((guix store) #:select (%store-prefix)) #:use-module (gnu services shepherd) + #:use-module (gnu services ssh) #:use-module (gnu packages admin) #:use-module (gnu packages bash) #:use-module (gnu packages bootloaders) @@ -262,6 +264,16 @@ You have been warned. Thanks for being so brave. ;; To facilitate copy/paste. (gpm-service) + ;; Add an SSH server to facilitate remote installs. + (service openssh-service-type + (openssh-configuration + (port-number 22) + (permit-root-login #t) + ;; The root account is passwordless, so make sure + ;; a password is set before allowing logins. + (allow-empty-passwords? #f) + (password-authentication? #t))) + ;; Since this is running on a USB stick with a unionfs as the root ;; file system, use an appropriate cache configuration. (nscd-service (nscd-configuration -- cgit v1.2.3 From 01cc84dadee4571e5793658e912ee05d60fbf060 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Tue, 11 Apr 2017 10:47:38 +0200 Subject: vm: Support arbitrary partition flags. * gnu/build/vm.scm (): Change BOOTABLE? to FLAGS. (initialize-partition-table): Pass each flag to parted. (initialize-hard-disk): Locate boot partition. * gnu/system/vm.scm (qemu-image): Adjust partition flags. --- gnu/system/vm.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 2ee5c2b1e7..e0e4d33d45 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -231,7 +231,7 @@ the image." (* 10 (expt 2 20)))) (label #$file-system-label) (file-system #$file-system-type) - (bootable? #t) + (flags '(boot)) (initializer initialize))))) (initialize-hard-disk "/dev/vda" #:partitions partitions -- cgit v1.2.3 From 4d415f0c3c0cf4acbc1297ccf2b27121846a4289 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Sat, 6 May 2017 22:53:58 +0200 Subject: vm: Support creating FAT partitions. * gnu/build/vm.scm (create-ext-file-system, create-fat-file-system): New procedures. (format-partition): Use them. Error for unknown file systems. * gnu/system/vm.scm (qemu-image): Include DOSFSTOOLS. * gnu/system/linux-initrd.scm (base-initrd): Always add nls_is8859-1.ko. --- gnu/system/linux-initrd.scm | 4 +--- gnu/system/vm.scm | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index dfe198e43e..3a5e76034a 100644 --- a/gnu/system/linux-initrd.scm +++ b/gnu/system/linux-initrd.scm @@ -268,6 +268,7 @@ loaded at boot time in the order in which they appear." "usbhid" "hid-generic" "hid-apple" ;keyboards during early boot "dm-crypt" "xts" "serpent_generic" "wp512" ;for encrypted root partitions "nvme" ;for new SSD NVMe devices + "nls_iso8859-1" ;for `mkfs.fat`, et.al ,@(if (string-match "^(x86_64|i[3-6]86)-" (%current-system)) '("pata_acpi" "pata_atiixp" ;for ATA controllers "isci") ;for SAS controllers like Intel C602 @@ -281,9 +282,6 @@ loaded at boot time in the order in which they appear." ,@(if (find (file-system-type-predicate "9p") file-systems) virtio-9p-modules '()) - ,@(if (find (file-system-type-predicate "vfat") file-systems) - '("nls_iso8859-1") - '()) ,@(if (find (file-system-type-predicate "btrfs") file-systems) '("btrfs") '()) diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index e0e4d33d45..64770baf1c 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -203,7 +203,7 @@ the image." (guix build utils)) (let ((inputs - '#$(append (list qemu parted e2fsprogs) + '#$(append (list qemu parted e2fsprogs dosfstools) (map canonical-package (list sed grep coreutils findutils gawk)) (if register-closures? (list guix) '()))) -- cgit v1.2.3 From ecf5d5376979fadd971559367bf553df89fcc62b Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Sun, 7 May 2017 15:31:30 +0200 Subject: vm: Add UEFI loader to disk images. * gnu/build/vm.scm (install-efi): New procedure. (initialize-hard-disk): Generate EFI blob when ESP is present. * gnu/system/vm.scm (qemu-image): Append 40MiB EFI System Partition. --- gnu/system/vm.scm | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 64770baf1c..d282ba557a 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -3,6 +3,7 @@ ;;; Copyright © 2016 Christopher Allan Webber ;;; Copyright © 2016 Leo Famulari ;;; Copyright © 2017 Mathieu Othacehe +;;; Copyright © 2017 Marius Bakke ;;; ;;; This file is part of GNU Guix. ;;; @@ -228,13 +229,26 @@ the image." #:system-directory #$os-drv)) (partitions (list (partition (size #$(- disk-image-size - (* 10 (expt 2 20)))) + (* 50 (expt 2 20)))) (label #$file-system-label) (file-system #$file-system-type) (flags '(boot)) - (initializer initialize))))) + (initializer initialize)) + ;; Append a small EFI System Partition for + ;; use with UEFI bootloaders. + (partition + ;; The standalone grub image is about 10MiB, but + ;; leave some room for custom or multiple images. + (size (* 40 (expt 2 20))) + (label "GNU-ESP") ;cosmetic only + ;; Use "vfat" here since this property is used + ;; when mounting. The actual FAT-ness is based + ;; on filesystem size (16 in this case). + (file-system "vfat") + (flags '(esp)))))) (initialize-hard-disk "/dev/vda" #:partitions partitions + #:grub-efi #$grub-efi #:bootloader-package #$(bootloader-package bootloader) #:bootcfg #$bootcfg-drv -- cgit v1.2.3 From 8ea98ee10cb5282c9205f536b20df0656a4df902 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Thu, 18 May 2017 19:24:36 +0200 Subject: doc: Update for UEFI systems. * doc/guix.texi (USB Stick Installation): Mention UEFI. (Preparing for Installation): Add notes about EFI System Partition, and mounting partitions before init. (Proceeding with the Installation): Mention the GRUB-EFI package. (Using the Configuration System): Lightweight desktop is now a UEFI system. (GRUB Configuration): Expand on package field. Add indexes. * gnu/system/examples/lightweight-desktop.tmpl: Adjust to native EFI configuration. --- gnu/system/examples/lightweight-desktop.tmpl | 30 ++++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/examples/lightweight-desktop.tmpl b/gnu/system/examples/lightweight-desktop.tmpl index 389ec8574b..6fb6283d29 100644 --- a/gnu/system/examples/lightweight-desktop.tmpl +++ b/gnu/system/examples/lightweight-desktop.tmpl @@ -4,23 +4,31 @@ (use-modules (gnu) (gnu system nss)) (use-service-modules desktop) -(use-package-modules wm ratpoison certs suckless) +(use-package-modules bootloaders certs ratpoison suckless wm) (operating-system (host-name "antelope") (timezone "Europe/Paris") (locale "en_US.utf8") - ;; Assuming /dev/sdX is the target hard disk, and "my-root" - ;; is the label of the target root file system. - (bootloader (grub-configuration (device "/dev/sdX"))) - - (file-systems (cons (file-system - (device "my-root") - (title 'label) - (mount-point "/") - (type "ext4")) - %base-file-systems)) + ;; Use the UEFI variant of GRUB with the EFI System + ;; Partition on /dev/sda1. + (bootloader (grub-configuration (grub grub-efi) + (device "/dev/sda1"))) + + ;; Assume the target root file system is labelled "my-root". + (file-systems (cons* (file-system + (device "my-root") + (title 'label) + (mount-point "/") + (type "ext4")) + (file-system + ;; Specify partition here since FAT + ;; labels are currently unsupported. + (device "/dev/sda1") + (mount-point "/boot/efi") + (type "vfat")) + %base-file-systems)) (users (cons (user-account (name "alice") -- cgit v1.2.3 From 9a1bfe764859365b6726f168da95b88a2d22403b Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Sat, 20 May 2017 21:28:20 +0200 Subject: vm: Increase default disk size to account for ESP partition. Fixes a test regression introduced by ecf5d5376979fadd971559367bf553df89fcc62b. * gnu/system/vm.scm (system-qemu-image/shared-store-script): 30MiB -> 70MiB. --- gnu/system/vm.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gnu/system') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index d282ba557a..ad5e6b75bb 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -499,7 +499,7 @@ with '-virtfs' options for the host file systems listed in SHARED-FS." (mappings '()) full-boot? (disk-image-size - (* (if full-boot? 500 30) + (* (if full-boot? 500 70) (expt 2 20)))) "Return a derivation that builds a script to run a virtual machine image of OS that shares its store with the host. -- cgit v1.2.3 From 0dc4a498a33eac046f9448f852949da61d8ded4d Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Mon, 22 May 2017 22:22:02 +0200 Subject: install: Add 'passwd' to installation image. * gnu/system/install.scm (installation-os): Add SHADOW in package list. --- gnu/system/install.scm | 1 + 1 file changed, 1 insertion(+) (limited to 'gnu/system') diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 9a6febfeba..0a78d030dd 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -341,6 +341,7 @@ Use Alt-F2 for documentation. (base-pam-services #:allow-empty-passwords? #t)) (packages (cons* (canonical-package glibc) ;for 'tzselect' & co. + shadow ;'passwd', for easy SSH access parted gptfdisk ddrescue grub ;mostly so xrefs to its manual work cryptsetup -- cgit v1.2.3