From 5c32857f91b26846d202f07226f201fd49852619 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 9 Apr 2019 09:31:14 +0200 Subject: doc: Adjust desktop instructions for GDM. * gnu/system/examples/desktop.tmpl: Adjust comment that referred to SLiM. --- gnu/system/examples/desktop.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl index baeb5e2d77..3931bad60d 100644 --- a/gnu/system/examples/desktop.tmpl +++ b/gnu/system/examples/desktop.tmpl @@ -58,8 +58,8 @@ gvfs) %base-packages)) - ;; Add GNOME and/or Xfce---we can choose at the log-in - ;; screen with F1. Use the "desktop" services, which + ;; Add GNOME and Xfce---we can choose at the log-in screen + ;; by clicking the gear. Use the "desktop" services, which ;; include the X11 log-in service, networking with ;; NetworkManager, and more. (services (append (list (service gnome-desktop-service-type) -- cgit v1.2.3 From 126d4c12ce18a35a0d971778133f05b7c6ad81b3 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 12 Apr 2019 14:15:59 +0200 Subject: install: Add standalone documentation service. * gnu/system/install.scm (log-to-info): Add 'tty' and 'user' parameters. Open the tty and change UIDs/GIDs. (documentation-shepherd-service): New procedure. (%documentation-users, documentation-service-type): New variables. (%installation-services): Use it instead of 'mingetty-service'. --- gnu/system/install.scm | 49 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 91e7b481e8..71a9c2f19b 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -73,11 +73,24 @@ ;;; Code: -(define (log-to-info) +;;; +;;; Documentation service. +;;; + +(define (log-to-info tty user) "Return a script that spawns the Info reader on the right section of the manual." (program-file "log-to-info" - #~(begin + #~(let ((tty (open-file #$(string-append "/dev/" tty) + "r0+"))) + (redirect-port tty (current-output-port)) + (redirect-port tty (current-error-port)) + (redirect-port tty (current-input-port)) + + (let ((pw (getpwnam #$user))) + (setgid (passwd:gid pw)) + (setuid (passwd:uid pw))) + ;; 'gunzip' is needed to decompress the doc. (setenv "PATH" (string-append #$gzip "/bin")) @@ -86,6 +99,33 @@ manual." "-f" (string-append #$guix "/share/info/guix.info") "-n" "System Installation")))) +(define (documentation-shepherd-service tty) + (list (shepherd-service + (provision (list (symbol-append 'term- (string->symbol tty)))) + (requirement '(user-processes host-name udev virtual-terminal)) + + (start #~(make-forkexec-constructor + (list #$(log-to-info tty "documentation")))) + (stop #~(make-kill-destructor))))) + +(define %documentation-users + ;; User account for the Info viewer. + (list (user-account (name "documentation") + (system? #t) + (group "nogroup") + (home-directory "/var/empty")))) + +(define documentation-service-type + ;; Documentation viewer service. + (service-type (name 'documentation) + (extensions + (list (service-extension shepherd-root-service-type + documentation-shepherd-service) + (service-extension account-service-type + (const %documentation-users)))) + (description "Run the Info reader on a tty."))) + + (define %backing-directory ;; Sub-directory used as the backing store for copy-on-write. "/tmp/guix-inst") @@ -239,10 +279,7 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m ;; Documentation. The manual is in UTF-8, but ;; 'console-font-service' sets up Unicode support and loads a font ;; with all the useful glyphs like em dash and quotation marks. - (mingetty-service (mingetty-configuration - (tty "tty2") - (auto-login "guest") - (login-program (log-to-info)))) + (service documentation-service-type "tty2") ;; Documentation add-on. %configuration-template-service -- cgit v1.2.3 From c7dc604253631588c659c1022256af98ec9262af Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 12 Apr 2019 17:13:26 +0200 Subject: installer: Choosing a locale opens the translated manual on tty2. Suggested by Florian Pelz. * gnu/system/install.scm (%installation-node-names): New variable. (log-to-info): Expect the chosen locale as an argument. Compute the language, Info file name, and node name. Install the locale. (documentation-shepherd-service): Add 'locale' parameter to the 'start' action and honor it. Set GUIX_LOCPATH and TERM as environment variables for the process. * gnu/installer.scm (apply-locale): Use (gnu services herd). Call 'stop-service' and 'start-service' with the chosen locale. --- gnu/installer.scm | 15 ++++++++++++--- gnu/system/install.scm | 52 +++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 55 insertions(+), 12 deletions(-) (limited to 'gnu/system') diff --git a/gnu/installer.scm b/gnu/installer.scm index 50e2e7d85e..6a7a556271 100644 --- a/gnu/installer.scm +++ b/gnu/installer.scm @@ -91,9 +91,17 @@ version of this file." (define apply-locale ;; Install the specified locale. - #~(lambda (locale-name) - (false-if-exception - (setlocale LC_ALL locale-name)))) + (with-imported-modules (source-module-closure '((gnu services herd))) + #~(lambda (locale) + (false-if-exception + (setlocale LC_ALL locale)) + + ;; Restart the documentation viewer so it displays the manual in + ;; language that corresponds to LOCALE. + (with-error-to-port (%make-void-port "w") + (lambda () + (stop-service 'term-tty2) + (start-service 'term-tty2 (list locale))))))) (define* (compute-locale-step #:key locales-name @@ -323,6 +331,7 @@ selected keymap." (gnu installer newt) ((gnu installer newt keymap) #:select (keyboard-layout->configuration)) + (gnu services herd) (guix i18n) (guix build utils) (ice-9 match)) diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 71a9c2f19b..d37315810d 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -77,12 +77,32 @@ ;;; Documentation service. ;;; +(define %installation-node-names + ;; Translated name of the "System Installation" node of the manual. Ideally + ;; we'd extract it from the 'guix-manual' gettext domain, but that one is + ;; usually not available at run time, hence this hack. + '(("de" . "Systeminstallation") + ("en" . "System Installation") + ("fr" . "Installation du système"))) + (define (log-to-info tty user) "Return a script that spawns the Info reader on the right section of the manual." (program-file "log-to-info" - #~(let ((tty (open-file #$(string-append "/dev/" tty) - "r0+"))) + #~(let* ((tty (open-file #$(string-append "/dev/" tty) + "r0+")) + (locale (cadr (command-line))) + (language (string-take locale + (string-index locale #\_))) + (infodir "/run/current-system/profile/share/info") + (per-lang (string-append infodir "/guix." language + ".info.gz")) + (file (if (file-exists? per-lang) + per-lang + (string-append infodir "/guix.info"))) + (node (or (assoc-ref '#$%installation-node-names + language) + "System Installation"))) (redirect-port tty (current-output-port)) (redirect-port tty (current-error-port)) (redirect-port tty (current-input-port)) @@ -94,18 +114,32 @@ manual." ;; 'gunzip' is needed to decompress the doc. (setenv "PATH" (string-append #$gzip "/bin")) - (execl (string-append #$info-reader "/bin/info") "info" - "-d" "/run/current-system/profile/share/info" - "-f" (string-append #$guix "/share/info/guix.info") - "-n" "System Installation")))) + ;; Change this process' locale so that command-line + ;; arguments to 'info' are properly encoded. + (catch #t + (lambda () + (setlocale LC_ALL locale) + (setenv "LC_ALL" locale)) + (lambda _ + ;; Sometimes LOCALE itself is not available. In that + ;; case pick the one UTF-8 locale that's known to work + ;; instead of failing. + (setlocale LC_ALL "en_US.utf8") + (setenv "LC_ALL" "en_US.utf8"))) + + (execl #$(file-append info-reader "/bin/info") + "info" "-d" infodir "-f" file "-n" node)))) (define (documentation-shepherd-service tty) (list (shepherd-service (provision (list (symbol-append 'term- (string->symbol tty)))) (requirement '(user-processes host-name udev virtual-terminal)) - - (start #~(make-forkexec-constructor - (list #$(log-to-info tty "documentation")))) + (start #~(lambda* (#:optional (locale "en_US.utf8")) + (fork+exec-command + (list #$(log-to-info tty "documentation") locale) + #:environment-variables + `("GUIX_LOCPATH=/run/current-system/locale" + "TERM=linux")))) (stop #~(make-kill-destructor))))) (define %documentation-users -- cgit v1.2.3 From 13fd0a30877acc8c152c37d0b04158f7b65e4646 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 12 Apr 2019 17:19:31 +0200 Subject: install: Use a font with more glyphs on tty2. * gnu/system/install.scm (%installation-services): For 'console-font-service-type', use LatGrkCyr-8x16 on tty2. --- gnu/system/install.scm | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/install.scm b/gnu/system/install.scm index d37315810d..c32bb6056e 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -342,12 +342,18 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m ;; since it takes the installation directory as an argument. (cow-store-service) - ;; Install Unicode support and a suitable font. Use a font that - ;; doesn't have more than 256 glyphs so that we can use colors with - ;; varying brightness levels (see note in setfont(8)). + ;; Install Unicode support and a suitable font. (service console-font-service-type - (map (lambda (tty) - (cons tty "lat9u-16")) + (map (match-lambda + ("tty2" + ;; Use a font that contains characters such as + ;; curly quotes as found in the manual. + '("tty2" . "LatGrkCyr-8x16")) + (tty + ;; Use a font that doesn't have more than 256 + ;; glyphs so that we can use colors with varying + ;; brightness levels (see note in setfont(8)). + `(,tty . "lat9u-16"))) '("tty1" "tty2" "tty3" "tty4" "tty5" "tty6"))) ;; To facilitate copy/paste. -- cgit v1.2.3 From 66ec389580d4f1e4b81e1c72afe2749a547a0e7c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 14 Apr 2019 17:03:34 +0200 Subject: vm: Do not mount /xchg with "cache=loose". Fixes . * gnu/system/vm.scm (%linux-vm-file-systems): Remove "cache=loose" for /xchg. (system-docker-image): Remove 'sync' call, now unneeded, and which was probably insufficient. --- gnu/system/vm.scm | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'gnu/system') diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index db9b1707d7..22e3fcc522 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -94,6 +94,12 @@ (define %linux-vm-file-systems ;; File systems mounted for 'derivation-in-linux-vm'. These are shared with ;; the host over 9p. + ;; + ;; The 9p documentation says that cache=loose is "intended for exclusive, + ;; read-only mounts", without additional details. It's much faster than the + ;; default cache=none, especially when copying and registering store items. + ;; Thus, use cache=loose, except for /xchg where we want to ensure + ;; consistency. (list (file-system (mount-point (%store-prefix)) (device "store") @@ -102,18 +108,12 @@ (flags '(read-only)) (options "trans=virtio,cache=loose") (check? #f)) - - ;; The 9p documentation says that cache=loose is "intended for - ;; exclusive, read-only mounts", without additional details. In - ;; practice it seems to work well for these, and it's much faster than - ;; the default cache=none, especially when copying and registering - ;; store items. (file-system (mount-point "/xchg") (device "xchg") (type "9p") (needed-for-boot? #t) - (options "trans=virtio,cache=loose") + (options "trans=virtio") (check? #f)) (file-system (mount-point "/tmp") @@ -530,10 +530,7 @@ should set REGISTER-CLOSURES? to #f." #$os #:compressor '(#+(file-append gzip "/bin/gzip") "-9n") #:creation-time (make-time time-utc 0 1) - #:transformations `((,root-directory -> ""))) - - ;; Make sure the tarball is fully written before rebooting. - (sync)))))) + #:transformations `((,root-directory -> "")))))))) (expression->derivation-in-linux-vm name build #:make-disk-image? #f -- cgit v1.2.3 From 0134ebc55b324dc073b68e3d64ef0d06cfdf35ce Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 15 Apr 2019 11:34:28 +0200 Subject: install: Provide a meaningful label. * gnu/system/install.scm (installation-os)[label]: New field. --- gnu/system/install.scm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gnu/system') diff --git a/gnu/system/install.scm b/gnu/system/install.scm index c32bb6056e..d887313132 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -27,6 +27,7 @@ #:use-module (guix gexp) #:use-module (guix store) #:use-module (guix monads) + #:use-module ((guix packages) #:select (package-version)) #:use-module ((guix store) #:select (%store-prefix)) #:use-module (gnu installer) #:use-module (gnu services dbus) @@ -423,6 +424,9 @@ Access documentation at any time by pressing Alt-F2.\x1b[0m (bootloader (bootloader-configuration (bootloader grub-bootloader) (target "/dev/sda"))) + (label (string-append "GNU Guix installation " + (package-version guix))) + (file-systems ;; Note: the disk image build code overrides this root file system with ;; the appropriate one. -- cgit v1.2.3