From 78b3748c1c5446f19e7a74ec424d61a7826fc843 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Sat, 23 Mar 2019 19:18:31 +0100 Subject: guix: dune-build-system: Add a package parameter. * guix/build-system/dune.scm: Add a package parameter. * guix/build/dune.scm (build, test, install): Use it. * doc/guix.texi: Document it. --- doc/guix.texi | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index d10fbce3a4..6e8ce3c084 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5816,6 +5816,11 @@ list of flags passed to the @code{dune} command during the build. The @code{#:jbuild?} parameter can be passed to use the @code{jbuild} command instead of the more recent @code{dune} command while building a package. Its default value is @code{#f}. + +The @code{#:package} parameter can be passed to specify a package name, which +is useful when a package contains multiple packages and you want to build +only one of them. This is equivalent to passing the @code{-p} argument to +@code{dune}. @end defvr @defvr {Scheme Variable} go-build-system -- cgit v1.2.3 From b28e4e3c0d37c397a8e8060c5764dce5871567f5 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Sun, 24 Mar 2019 19:36:30 +0200 Subject: doc: Remove instances of powerpc-linux being a supported Guix architecture. * doc/contributing.texi (Submitting Patches): Remove powerpc-linux examples. * doc/guix.texi (Virtualization Services): Replace powerpc-linux example with mips64el-linux. --- doc/contributing.texi | 7 +++---- doc/guix.texi | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/contributing.texi b/doc/contributing.texi index 9459c481a7..5331d3e18a 100644 --- a/doc/contributing.texi +++ b/doc/contributing.texi @@ -827,7 +827,7 @@ your @code{operating-system} configuration: @example (service qemu-binfmt-service-type (qemu-binfmt-configuration - (platforms (lookup-qemu-platforms "arm" "aarch64" "ppc" "mips64el")) + (platforms (lookup-qemu-platforms "arm" "aarch64" "mips64el")) (guix-support? #t))) @end example @@ -835,12 +835,11 @@ Then reconfigure your system. You can then build packages for different platforms by specifying the @code{--system} option. For example, to build the "hello" package for -the armhf, aarch64, powerpc, or mips64 architectures, you would run the -following commands, respectively: +the armhf, aarch64, or mips64 architectures, you would run the following +commands, respectively: @example guix build --system=armhf-linux --rounds=2 hello guix build --system=aarch64-linux --rounds=2 hello -guix build --system=powerpc-linux --rounds=2 hello guix build --system=mips64el-linux --rounds=2 hello @end example diff --git a/doc/guix.texi b/doc/guix.texi index 6e8ce3c084..a58ca4b4a7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -21629,7 +21629,7 @@ emulated: @example (service qemu-binfmt-service-type (qemu-binfmt-configuration - (platforms (lookup-qemu-platforms "arm" "aarch64" "ppc")))) + (platforms (lookup-qemu-platforms "arm" "aarch64" "mips64el")))) @end example In this example, we enable transparent emulation for the ARM and aarch64 -- cgit v1.2.3 From 8d058e7b1b1a409d3d9cc29c5650a98db4e78783 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 17 Mar 2019 22:37:53 +0100 Subject: bootloader: Add a 'keyboard-layout' field. * gnu/bootloader/grub.scm (keyboard-layout-file): New procedure. (grub-configuration-file)[keyboard-layout-file]: New variable. [builder]: Use it. * gnu/bootloader.scm ()[keyboard-layout]: New field. * doc/guix.texi (Bootloader Configuration): Document it. Co-authored-by: nee --- doc/guix.texi | 28 ++++++++++++++++++++++++++++ gnu/bootloader.scm | 3 +++ gnu/bootloader/grub.scm | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index a58ca4b4a7..af74f7a636 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -23654,6 +23654,34 @@ current system. The number of seconds to wait for keyboard input before booting. Set to 0 to boot immediately, and to -1 to wait indefinitely. +@cindex keyboard layout, for the bootloader +@item @code{keyboard-layout} (default: @code{#f}) +If this is @code{#f}, the bootloader's menu (if any) uses the default keyboard +layout, usually US@tie{}English (``qwerty''). + +Otherwise, this must be a @code{keyboard-layout} object. For instance, the +following example defines a standard German keyboard layout: + +@example +(keyboard-layout "de") +@end example + +@noindent +while the example below designates the bépo layout for French: + +@example +(keyboard-layout "fr" "bepo") +@end example + +The layout name and variant must match an existing layout in the +@code{xkeyboard-config} package under the @file{share/X11/xkb/symbols} +directory. + +@quotation Note +This option is currently ignored by bootloaders other than @code{grub} and +@code{grub-efi}. +@end quotation + @item @code{theme} (default: @var{#f}) The bootloader theme object describing the theme to use. If no theme is provided, some bootloaders might use a default theme, that's true diff --git a/gnu/bootloader.scm b/gnu/bootloader.scm index e48bcc073c..a381f67145 100644 --- a/gnu/bootloader.scm +++ b/gnu/bootloader.scm @@ -47,6 +47,7 @@ (define-module (gnu bootloader) bootloader-configuration-menu-entries bootloader-configuration-default-entry bootloader-configuration-timeout + bootloader-configuration-keyboard-layout bootloader-configuration-theme bootloader-configuration-terminal-outputs bootloader-configuration-terminal-inputs @@ -113,6 +114,8 @@ (define-record-type* (default 0)) (timeout bootloader-configuration-timeout ;seconds as integer (default 5)) + (keyboard-layout bootloader-configuration-keyboard-layout ; | #f + (default #f)) (theme bootloader-configuration-theme ;bootloader-specific theme (default #f)) (terminal-outputs bootloader-configuration-terminal-outputs ;list of symbols diff --git a/gnu/bootloader/grub.scm b/gnu/bootloader/grub.scm index 14aede72c5..e97a17b3e2 100644 --- a/gnu/bootloader/grub.scm +++ b/gnu/bootloader/grub.scm @@ -27,8 +27,10 @@ (define-module (gnu bootloader grub) #:use-module (gnu bootloader) #:use-module (gnu system uuid) #:use-module (gnu system file-systems) + #:use-module (gnu system keyboard) #:autoload (gnu packages bootloaders) (grub) #:autoload (gnu packages gtk) (guile-cairo guile-rsvg) + #:autoload (gnu packages xorg) (xkeyboard-config) #:use-module (ice-9 match) #:use-module (ice-9 regex) #:use-module (srfi srfi-1) @@ -219,6 +221,26 @@ (define image ;;; Configuration file. ;;; +(define* (keyboard-layout-file layout + #:key + (grub grub)) + "Process the X keyboard layout description LAYOUT, a record, +and return a file in the format for GRUB keymaps. LAYOUT must be present in +the 'share/X11/xkb/symbols/' directory of 'xkeyboard-config'." + (define builder + (with-imported-modules '((guix build utils)) + #~(begin + (use-modules (guix build utils)) + + ;; 'grub-kbdcomp' passes all its arguments but '-o' to 'ckbcomp' + ;; (from the 'console-setup' package). + (invoke #$(file-append grub "/bin/grub-mklayout") + "-i" #+(keyboard-layout->console-keymap layout) + "-o" #$output)))) + + (computed-file (string-append "grub-keymap." (keyboard-layout-name layout)) + builder)) + (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." @@ -330,6 +352,18 @@ (define sugar #:system system #:port #~port)) + (define keyboard-layout-config + (let ((layout (bootloader-configuration-keyboard-layout config)) + (grub (bootloader-package + (bootloader-configuration-bootloader config)))) + #~(let ((keymap #$(and layout + (keyboard-layout-file layout #:grub grub)))) + (when keymap + (format port "\ +terminal_input at_keyboard +insmod keylayouts +keymap ~a~%" keymap))))) + (define builder #~(call-with-output-file #$output (lambda (port) @@ -338,6 +372,7 @@ (define builder # will be lost upon reconfiguration. ") #$sugar + #$keyboard-layout-config (format port " set default=~a set timeout=~a~%" -- cgit v1.2.3 From 956607e34095e99235706e94b61376a4c7c497bf Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 18 Mar 2019 21:52:18 +0100 Subject: services: xorg: Remove unused #:guile parameter. * gnu/services/xorg.scm (xorg-wrapper): Remove #:guile, which was unused. (xorg-start-command): Likewise. (xinitrc): Likewise. --- doc/guix.texi | 2 +- gnu/services/xorg.scm | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index af74f7a636..5789b3b99b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -13352,7 +13352,7 @@ type @code{}. @end example @end deffn -@deffn {Scheme Procedure} xorg-start-command [#:guile] @ +@deffn {Scheme Procedure} xorg-start-command @ [#:modules %default-xorg-modules] @ [#:fonts %default-xorg-fonts] @ [#:configuration-file (xorg-configuration-file @dots{})] @ diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index f2a3c28c90..8381a7ed04 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -261,7 +261,6 @@ (define files #t)))) (define* (xorg-wrapper #:key - (guile (canonical-package guile-2.0)) (modules %default-xorg-modules) (configuration-file (xorg-configuration-file #:modules modules)) @@ -287,7 +286,6 @@ (define exp (program-file "X-wrapper" exp)) (define* (xorg-start-command #:key - (guile (canonical-package guile-2.0)) (modules %default-xorg-modules) (fonts %default-xorg-fonts) (configuration-file @@ -300,8 +298,7 @@ (define* (xorg-start-command #:key @code{xorg-wrapper} for more details on the arguments. The result should be used in place of @code{startx}." (define X - (xorg-wrapper #:guile guile - #:configuration-file configuration-file + (xorg-wrapper #:configuration-file configuration-file #:modules modules #:xorg-server xorg-server)) (define exp @@ -312,9 +309,7 @@ (define exp (program-file "startx" exp)) -(define* (xinitrc #:key - (guile (canonical-package guile-2.0)) - fallback-session) +(define* (xinitrc #:key fallback-session) "Return a system-wide xinitrc script that starts the specified X session, which should be passed to this script as the first argument. If not, the @var{fallback-session} will be used or, if @var{fallback-session} is false, a -- cgit v1.2.3 From b2e564515a811c75ed9bd30969bc48ac4eadebfb Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 18 Mar 2019 22:56:13 +0100 Subject: services: xorg: Define an record type. * gnu/services/xorg.scm (): New record type. (xorg-configuration-file): Remove. (xorg-wrapper): Remove #:modules, #:configuration-file, and #:xorg-server; add optional 'config' parameter instead. Adjust accordingly. (xorg-start-command): Likewise. * doc/guix.texi (X Window): Document 'xorg-configuration'. Update 'xorg-start-command' documentation. Remove 'xorg-configuration-file' documentation. --- doc/guix.texi | 118 +++++++++++++++---------------------------------- gnu/services/xorg.scm | 119 +++++++++++++++++++++++++------------------------- 2 files changed, 95 insertions(+), 142 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 5789b3b99b..b49f651562 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -13352,99 +13352,53 @@ type @code{}. @end example @end deffn -@deffn {Scheme Procedure} xorg-start-command @ - [#:modules %default-xorg-modules] @ - [#:fonts %default-xorg-fonts] @ - [#:configuration-file (xorg-configuration-file @dots{})] @ - [#:xorg-server @var{xorg-server}] - [#:xserver-arguments '("-nolisten" "tcp")] -Return a @code{startx} script in which @var{modules}, a list of X module -packages, and @var{fonts}, a list of X font directories, are available. See -@code{xorg-wrapper} for more details on the arguments. The result should be -used in place of @code{startx}. +@cindex Xorg, configuration +@deftp {Data Type} xorg-configuration +This data type represents the configuration of the Xorg graphical display +server. Note that there is not Xorg service; instead, the X server is started +by a ``display manager'' such as GDM, SDDM, and SLiM. Thus, the configuration +of these display managers aggregates an @code{xorg-configuration} record. -Usually the X server is started by a login manager. -@end deffn +@table @asis +@item @code{modules} (default: @code{%default-xorg-modules}) +This is a list of @dfn{module packages} loaded by the Xorg +server---e.g., @code{xf86-video-vesa}, @code{xf86-input-keyboard}, and so on. -@cindex @code{-listen tcp}, for X11. -This procedure is useful to override command line options for the X server, -such as having it listen to over TCP: +@item @code{fonts} (default: @code{%default-xorg-fonts}) +This is a list of font directories to add to the server's @dfn{font path}. -@example -(operating-system - ... - (services - (modify-services %desktop-services - (slim-service-type config => - (slim-configuration - (inherit config) - (startx (xorg-start-command - #:xserver-arguments '("-listen" "tcp")))))))) -@end example - -@deffn {Scheme Procedure} xorg-configuration-file @ - [#:modules %default-xorg-modules] @ - [#:fonts %default-xorg-fonts] @ - [#:drivers '()] [#:resolutions '()] [#:extra-config '()] -Return a configuration file for the Xorg server containing search paths for -all the common drivers. - -@var{modules} must be a list of @dfn{module packages} loaded by the Xorg -server---e.g., @code{xf86-video-vesa}, @code{xf86-input-keyboard}, and so on. -@var{fonts} must be a list of font directories to add to the server's -@dfn{font path}. +@item @code{drivers} (default: @code{'()}) +This must be either the empty list, in which case Xorg chooses a graphics +driver automatically, or a list of driver names that will be tried in this +order---e.g., @code{("modesetting" "vesa")}. -@var{drivers} must be either the empty list, in which case Xorg chooses a -graphics driver automatically, or a list of driver names that will be tried in -this order---e.g., @code{("modesetting" "vesa")}. +@item @code{resolutions} (default: @code{'()}) +When @code{resolutions} is the empty list, Xorg chooses an appropriate screen +resolution. Otherwise, it must be a list of resolutions---e.g., @code{((1024 +768) (640 480))}. -Likewise, when @var{resolutions} is the empty list, Xorg chooses an -appropriate screen resolution; otherwise, it must be a list of -resolutions---e.g., @code{((1024 768) (640 480))}. +@item @code{extra-config} (default: @code{'()}) +This is a list of strings or objects appended to the configuration file. It +is used to pass extra text to be added verbatim to the configuration file. -Last, @var{extra-config} is a list of strings or objects appended to the -configuration file. It is used to pass extra text to be -added verbatim to the configuration file. +@item @code{server} (default: @code{xorg-server}) +This is the package providing the Xorg server. -@cindex keymap -@cindex keyboard layout -This procedure is especially useful to configure a different keyboard layout -than the default US keymap. For instance, to use the ``bépo'' keymap by -default on the display manager: +@item @code{server-arguments} (default: @code{%default-xorg-server-arguments}) +This is the list of command-line arguments to pass to the X server. The +default is @code{-nolisten tcp}. +@end table +@end deftp -@example -(define bepo-evdev - "Section \"InputClass\" - Identifier \"evdev keyboard catchall\" - Driver \"evdev\" - MatchIsKeyboard \"on\" - Option \"xkb_layout\" \"fr\" - Option \"xkb_variant\" \"bepo\" -EndSection") +@deffn {Scheme Procedure} xorg-start-command [@var{config}] +Return a @code{startx} script in which the modules, fonts, etc. specified +in @var{config}, are available. The result should be used in place of +@code{startx}. -(operating-system - ... - (services - (modify-services %desktop-services - (slim-service-type config => - (slim-configuration - (inherit config) - (startx (xorg-start-command - #:configuration-file - (xorg-configuration-file - #:extra-config - (list bepo-evdev))))))))) -@end example - -The @code{MatchIsKeyboard} line specifies that we only apply the configuration -to keyboards. Without this line, other devices such as touchpad may not work -correctly because they will be attached to the wrong driver. In this example, -the user typically used @code{setxkbmap fr bepo} to set their favorite keymap -once logged in. The first argument corresponds to the layout, while the second -argument corresponds to the variant. The @code{xkb_variant} line can be omitted -to select the default variant. +Usually the X server is started by a login manager. @end deffn + @deffn {Scheme Procedure} screen-locker-service @var{package} [@var{program}] Add @var{package}, a package for a screen locker or screen saver whose command is @var{program}, to the set of setuid programs and add a PAM entry diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 8381a7ed04..3c547c1303 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -48,7 +48,16 @@ (define-module (gnu services xorg) #:use-module (srfi srfi-9) #:use-module (srfi srfi-26) #:use-module (ice-9 match) - #:export (xorg-configuration-file + #:export (xorg-configuration + xorg-configuration? + xorg-configuration-modules + xorg-configuration-fonts + xorg-configuration-drivers + xorg-configuration-resolutions + xorg-configuration-extra-config + xorg-configuration-server + xorg-configuration-server-arguments + %default-xorg-modules %default-xorg-fonts xorg-wrapper @@ -122,33 +131,36 @@ (define %default-xorg-fonts "/share/fonts/X11/misc") (file-append font-adobe75dpi "/share/fonts/X11/75dpi"))) -(define* (xorg-configuration-file #:key - (modules %default-xorg-modules) - (fonts %default-xorg-fonts) - (drivers '()) (resolutions '()) - (extra-config '())) - "Return a configuration file for the Xorg server containing search paths for -all the common drivers. - -@var{modules} must be a list of @dfn{module packages} loaded by the Xorg -server---e.g., @code{xf86-video-vesa}, @code{xf86-input-keyboard}, and so on. -@var{fonts} must be a list of font directories to add to the server's -@dfn{font path}. - -@var{drivers} must be either the empty list, in which case Xorg chooses a -graphics driver automatically, or a list of driver names that will be tried in -this order---e.g., @code{(\"modesetting\" \"vesa\")}. - -Likewise, when @var{resolutions} is the empty list, Xorg chooses an -appropriate screen resolution; otherwise, it must be a list of -resolutions---e.g., @code{((1024 768) (640 480))}. - -Last, @var{extra-config} is a list of strings or objects appended to the -configuration file. It is used to pass extra text to be -added verbatim to the configuration file." +(define %default-xorg-server-arguments + ;; Default command-line arguments for X. + '("-nolisten" "tcp")) + +;; Configuration of an Xorg server. +(define-record-type* + xorg-configuration make-xorg-configuration + xorg-configuration? + (modules xorg-configuration-modules ;list of packages + (default %default-xorg-modules)) + (fonts xorg-configuration-fonts ;list of packges + (default %default-xorg-fonts)) + (drivers xorg-configuration-drivers ;list of strings + (default '())) + (resolutions xorg-configuration-resolutions ;list of tuples + (default '())) + (extra-config xorg-configuration-extra-config ;list of strings + (default '())) + (server xorg-configuration-server ;package + (default xorg-server)) + (server-arguments xorg-configuration-server-arguments ;list of strings + (default %default-xorg-server-arguments))) + +(define (xorg-configuration->file config) + "Compute an Xorg configuration file corresponding to CONFIG, an + record." (define all-modules ;; 'xorg-server' provides 'fbdevhw.so' etc. - (append modules (list xorg-server))) + (append (xorg-configuration-modules config) + (list xorg-server))) (define build #~(begin @@ -159,7 +171,7 @@ (define build (call-with-output-file #$output (lambda (port) (define drivers - '#$drivers) + '#$(xorg-configuration-drivers config)) (define (device-section driver) (string-append " @@ -201,7 +213,7 @@ (define (expand modules) (display "Section \"Files\"\n" port) (for-each (lambda (font) (format port " FontPath \"~a\"~%" font)) - '#$fonts) + '#$(xorg-configuration-fonts config)) (for-each (lambda (module) (format port " ModulePath \"~a\"~%" @@ -221,7 +233,8 @@ (define (expand modules) port) (newline port) (display (string-join - (map (cut screen-section <> '#$resolutions) + (map (cut screen-section <> + '#$(xorg-configuration-resolutions config)) drivers) "\n") port) @@ -229,11 +242,10 @@ (define (expand modules) (for-each (lambda (config) (display config port)) - '#$extra-config))))) + '#$(xorg-configuration-extra-config config)))))) (computed-file "xserver.conf" build)) - (define (xorg-configuration-directory modules) "Return a directory that contains the @code{.conf} files for X.org that includes the @code{share/X11/xorg.conf.d} directories of each package listed @@ -260,51 +272,38 @@ (define files files) #t)))) -(define* (xorg-wrapper #:key - (modules %default-xorg-modules) - (configuration-file (xorg-configuration-file - #:modules modules)) - (xorg-server xorg-server)) - "Return a derivation that builds a @var{guile} script to start the X server -from @var{xorg-server}. @var{configuration-file} is the server configuration -file or a derivation that builds it; when omitted, the result of -@code{xorg-configuration-file} is used. The resulting script should be used -in place of @code{/usr/bin/X}." +(define* (xorg-wrapper #:optional (config (xorg-configuration))) + "Return a derivation that builds a script to start the X server with the +given @var{config}. The resulting script should be used in place of +@code{/usr/bin/X}." (define exp ;; Write a small wrapper around the X server. #~(begin (setenv "XORG_DRI_DRIVER_PATH" (string-append #$mesa "/lib/dri")) (setenv "XKB_BINDIR" (string-append #$xkbcomp "/bin")) - (let ((X (string-append #$xorg-server "/bin/X"))) + (let ((X (string-append #$(xorg-configuration-server config) "/bin/X"))) (apply execl X X "-xkbdir" (string-append #$xkeyboard-config "/share/X11/xkb") - "-config" #$configuration-file - "-configdir" #$(xorg-configuration-directory modules) + "-config" #$(xorg-configuration->file config) + "-configdir" #$(xorg-configuration-directory + (xorg-configuration-modules config)) (cdr (command-line)))))) (program-file "X-wrapper" exp)) -(define* (xorg-start-command #:key - (modules %default-xorg-modules) - (fonts %default-xorg-fonts) - (configuration-file - (xorg-configuration-file #:modules modules - #:fonts fonts)) - (xorg-server xorg-server) - (xserver-arguments '("-nolisten" "tcp"))) - "Return a @code{startx} script in which @var{modules}, a list of X module -packages, and @var{fonts}, a list of X font directories, are available. See -@code{xorg-wrapper} for more details on the arguments. The result should be -used in place of @code{startx}." +(define* (xorg-start-command #:optional (config (xorg-configuration))) + "Return a @code{startx} script in which the modules, fonts, etc. specified +in @var{config}, are available. The result should be used in place of +@code{startx}." (define X - (xorg-wrapper #:configuration-file configuration-file - #:modules modules - #:xorg-server xorg-server)) + (xorg-wrapper config)) + (define exp ;; Write a small wrapper around the X server. #~(apply execl #$X #$X ;; Second #$X is for argv[0]. - "-logverbose" "-verbose" "-terminate" #$@xserver-arguments + "-logverbose" "-verbose" "-terminate" + #$@(xorg-configuration-server-arguments config) (cdr (command-line)))) (program-file "startx" exp)) -- cgit v1.2.3 From 554b8607396785dcde6eb391f75f98a07ec582fd Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 19 Mar 2019 21:26:33 +0100 Subject: services: sddm, slim, gdm: Take an record. * gnu/services/sddm.scm ()[xorg-server-path] [xserver-arguments]: Remove. [xorg-configuration]: New field. (sddm-configuration-file): Adjust accordingly. * gnu/services/xorg.scm ()[startx]: Remove. [xorg-configuration]: New field. (slim-shepherd-service, slim-service): Adjust accordingly. ()[x-server]: Remove. [xorg-configuration]: New field. (gdm-shepherd-service, gdm-service): Adjust accordingly. * doc/guix.texi (X Window): Update accordingly. --- doc/guix.texi | 11 ++++------- gnu/services/sddm.scm | 14 ++++++++------ gnu/services/xorg.scm | 19 +++++++++---------- 3 files changed, 21 insertions(+), 23 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index b49f651562..5511aaaf57 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -13223,8 +13223,8 @@ your user profile. Failing to do that, if @code{auto-login-session} is false, you will be unable to log in. @end quotation -@item @code{startx} (default: @code{(xorg-start-command)}) -The command used to start the X11 graphical server. +@item @code{xorg-configuration} (default @code{(xorg-configuration)}) +Configuration of the Xorg graphical server. @item @code{xauth} (default: @code{xauth}) The XAuth package to use. @@ -13300,8 +13300,8 @@ Script to run before starting a wayland session. @item @code{sessions-directory} (default "/run/current-system/profile/share/wayland-sessions") Directory to look for desktop files starting wayland sessions. -@item @code{xorg-server-path} (default @code{xorg-start-command}) -Path to xorg-server. +@item @code{xorg-configuration} (default @code{(xorg-configuration)}) +Configuration of the Xorg graphical server. @item @code{xauth-path} (default @code{#~(string-append #$xauth "/bin/xauth")}) Path to xauth. @@ -13324,9 +13324,6 @@ Directory to look for desktop files starting X sessions. @item @code{minimum-vt} (default: 7) Minimum VT to use. -@item @code{xserver-arguments} (default "-nolisten tcp") -Arguments to pass to xorg-server. - @item @code{auto-login-user} (default "") User to use for auto-login. diff --git a/gnu/services/sddm.scm b/gnu/services/sddm.scm index 2ebfe22016..a33eb39c43 100644 --- a/gnu/services/sddm.scm +++ b/gnu/services/sddm.scm @@ -1,5 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2016 David Craven +;;; Copyright © 2019 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -83,8 +84,8 @@ (define-record-type* (sessions-directory sddm-configuration-sessions-directory (default "/run/current-system/profile/share/wayland-sessions")) ;; [X11] - (xorg-server-path sddm-configuration-xorg-server-path - (default (xorg-start-command))) + (xorg-configuration sddm-configuration-xorg + (default (xorg-configuration))) (xauth-path sddm-configuration-xauth-path (default (file-append xauth "/bin/xauth"))) (xephyr-path sddm-configuration-xephyr-path @@ -99,8 +100,6 @@ (define-record-type* (default "/run/current-system/profile/share/xsessions")) (minimum-vt sddm-configuration-minimum-vt (default 7)) - (xserver-arguments sddm-configuration-xserver-arguments - (default "-nolisten tcp")) ;; [Autologin] (auto-login-user sddm-configuration-auto-login-user @@ -140,7 +139,8 @@ (define (sddm-configuration-file config) SessionDir=" (sddm-configuration-sessions-directory config) " [X11] -ServerPath=" (sddm-configuration-xorg-server-path config) " +ServerPath=" (xorg-configuration-server + (sddm-configuration-xorg config)) " XauthPath=" (sddm-configuration-xauth-path config) " XephyrPath=" (sddm-configuration-xephyr-path config) " DisplayCommand=" (sddm-configuration-xdisplay-start config) " @@ -148,7 +148,9 @@ (define (sddm-configuration-file config) SessionCommand=" (sddm-configuration-xsession-command config) " SessionDir=" (sddm-configuration-xsessions-directory config) " MinimumVT=" (number->string (sddm-configuration-minimum-vt config)) " -ServerArguments=" (sddm-configuration-xserver-arguments config) " +ServerArguments=" (string-join + (xorg-configuration-server-arguments + (sddm-configuration-xorg config))) " [Autologin] User=" (sddm-configuration-auto-login-user config) " diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 3c547c1303..a3a4d769d7 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -436,8 +436,8 @@ (define-record-type* (default shepherd)) (auto-login-session slim-configuration-auto-login-session (default #f)) - (startx slim-configuration-startx - (default (xorg-start-command))) + (xorg-configuration slim-configuration-xorg + (default (xorg-configuration))) (sessreg slim-configuration-sessreg (default sessreg))) @@ -454,7 +454,7 @@ (define slim.cfg (slim-configuration-auto-login-session config))) (slim (slim-configuration-slim config)) (xauth (slim-configuration-xauth config)) - (startx (slim-configuration-startx config)) + (startx (xorg-start-command (slim-configuration-xorg config))) (shepherd (slim-configuration-shepherd config)) (theme-name (slim-configuration-theme-name config)) (sessreg (slim-configuration-sessreg config))) @@ -561,8 +561,7 @@ (define-deprecated (slim-service #:key (slim slim) (auto-login? auto-login?) (default-user default-user) (theme theme) (theme-name theme-name) (xauth xauth) (shepherd shepherd) - (auto-login-session auto-login-session) - (startx startx)))) + (auto-login-session auto-login-session)))) ;;; @@ -641,8 +640,8 @@ (define-record-type* (default-user gdm-configuration-default-user (default #f)) (gnome-shell-assets gdm-configuration-gnome-shell-assets (default (list adwaita-icon-theme font-cantarell))) - (x-server gdm-configuration-x-server - (default (xorg-wrapper))) + (xorg-configuration gdm-configuration-xorg + (default (xorg-configuration))) (x-session gdm-configuration-x-session (default (xinitrc)))) @@ -714,7 +713,8 @@ (define (gdm-shepherd-service config) #$(gdm-configuration-dbus-daemon config)) (string-append "GDM_X_SERVER=" - #$(gdm-configuration-x-server config)) + #$(xorg-wrapper + (gdm-configuration-xorg config))) (string-append "GDM_X_SESSION=" #$(gdm-configuration-x-session config)) @@ -779,7 +779,6 @@ (define-deprecated (gdm-service #:key (gdm gdm) (service gdm-service-type (gdm-configuration (gdm gdm) - (allow-empty-passwords? allow-empty-passwords?) - (x-server x-server)))) + (allow-empty-passwords? allow-empty-passwords?)))) ;;; xorg.scm ends here -- cgit v1.2.3 From 598757e038ab5dea3b59c9c248a2ad860c41fe62 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 19 Mar 2019 21:34:02 +0100 Subject: services: xorg: Add a 'keyboard-layout' field in . * gnu/services/xorg.scm ()[keyboard-layout]: New field. (xorg-configuration->file)[input-class-section]: New procedure. Use it. * doc/guix.texi (X Window): Document 'keyboard-layout' field. Co-authored-by: nee --- doc/guix.texi | 9 +++++++++ gnu/services/xorg.scm | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 5511aaaf57..4a8b66703d 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -13374,6 +13374,15 @@ When @code{resolutions} is the empty list, Xorg chooses an appropriate screen resolution. Otherwise, it must be a list of resolutions---e.g., @code{((1024 768) (640 480))}. +@cindex keyboard layout, for Xorg +@cindex keymap, for Xorg +@item @code{keyboard-layout} (default: @code{#f}) +If this is @code{#f}, Xorg uses the default keyboard layout---usually US +English (``qwerty'') for a 105-key PC keyboard. + +Otherwise this must be a @code{keyboard-layout} object specifying the keyboard +layout in use when Xorg is running. + @item @code{extra-config} (default: @code{'()}) This is a list of strings or objects appended to the configuration file. It is used to pass extra text to be added verbatim to the configuration file. diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index a3a4d769d7..05465f3bdf 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -25,6 +25,7 @@ (define-module (gnu services xorg) #:use-module (gnu services) #:use-module (gnu services shepherd) #:use-module (gnu system pam) + #:use-module (gnu system keyboard) #:use-module (gnu services dbus) #:use-module ((gnu packages base) #:select (canonical-package)) #:use-module (gnu packages guile) @@ -147,6 +148,8 @@ (define-record-type* (default '())) (resolutions xorg-configuration-resolutions ;list of tuples (default '())) + (keyboard-layout xorg-configuration-keyboard-layout ;#f | + (default #f)) (extra-config xorg-configuration-extra-config ;list of strings (default '())) (server xorg-configuration-server ;package @@ -195,6 +198,31 @@ (define (screen-section driver resolutions) EndSubSection EndSection")) + (define (input-class-section layout variant model options) + (string-append " +Section \"InputClass\" + Identifier \"evdev keyboard catchall\" + MatchIsKeyboard \"on\" + Option \"XkbLayout\" " (object->string layout) + (if variant + (string-append " Option \"XkbVariant\" \"" + variant "\"") + "") + (if model + (string-append " Option \"XkbModel\" \"" + model "\"") + "") + (match options + (() + "") + (_ + (string-append " Option \"XkbOptions\" \"" + (string-join options ",") "\""))) " + + MatchDevicePath \"/dev/input/event*\" + Driver \"evdev\" +EndSection\n")) + (define (expand modules) ;; Append to MODULES the relevant /lib/xorg/modules ;; sub-directories. @@ -240,6 +268,19 @@ (define (expand modules) port) (newline port) + (let ((layout #$(and=> (xorg-configuration-keyboard-layout config) + keyboard-layout-name)) + (variant #$(and=> (xorg-configuration-keyboard-layout config) + keyboard-layout-variant)) + (model #$(and=> (xorg-configuration-keyboard-layout config) + keyboard-layout-model)) + (options '#$(keyboard-layout-options + (xorg-configuration-keyboard-layout config)))) + (when layout + (display (input-class-section layout variant model options) + port) + (newline port))) + (for-each (lambda (config) (display config port)) '#$(xorg-configuration-extra-config config)))))) -- cgit v1.2.3 From ae7a316b9da0d1a50c5abdc531c68c8e98e561c9 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès 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. --- doc/guix.texi | 34 +++++++++++++++++++++++++++++++++- gnu/build/linux-boot.scm | 15 +++++++++++++-- gnu/system.scm | 7 +++++-- gnu/system/linux-initrd.scm | 26 ++++++++++++++++++++++++-- 4 files changed, 75 insertions(+), 7 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 4a8b66703d..fb3fef689a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -10405,6 +10405,24 @@ the command-line of the kernel---e.g., @code{("console=ttyS0")}. @item @code{bootloader} The system bootloader configuration object. @xref{Bootloader Configuration}. +@item @code{keyboard-layout} (default: @code{#f}) +This field specifies the keyboard layout to use in the console. It can be +either @code{#f}, in which case the default keyboard layout is used (usually +US English), or a @code{} record. + +This keyboard layout is in effect as soon as the kernel has booted. For +instance, it is the keyboard layout in effect when you type a passphrase if +your root file system is on a @code{luks-device-mapping} mapped device +(@pxref{Mapped Devices}). + +@quotation Note +This does @emph{not} specify the keyboard layout used by the bootloader, nor +that used by the graphical display server. @xref{Bootloader Configuration}, +for information on how to specify the bootloader's keyboard layout. @xref{X +Window}, for information on how to specify the keyboard layout used by the X +Window System. +@end quotation + @item @code{initrd-modules} (default: @code{%base-initrd-modules}) @cindex initrd @cindex initial RAM disk @@ -23493,6 +23511,7 @@ here is how to use it and customize it further. @cindex initial RAM disk @deffn {Scheme Procedure} raw-initrd @var{file-systems} @ [#:linux-modules '()] [#:mapped-devices '()] @ + [#:keyboard-layout #f] @ [#:helper-packages '()] [#:qemu-networking? #f] [#:volatile-root? #f] Return a derivation that builds a raw initrd. @var{file-systems} is a list of file systems to be mounted by the initrd, possibly in addition to @@ -23504,6 +23523,12 @@ the root file system specified on the kernel command line via @code{--root}. include @code{e2fsck/static} or other packages needed by the initrd to check the root file system. +When true, @var{keyboard-layout} is a @code{} record denoting +the desired console keyboard layout. This is done before @var{mapped-devices} +are set up and before @var{file-systems} are mounted such that, should the +user need to enter a passphrase or use the REPL, this happens using the +intended keyboard layout. + When @var{qemu-networking?} is true, set up networking with the standard QEMU parameters. When @var{virtio?} is true, load additional modules so that the initrd can be used as a QEMU guest with para-virtualized I/O drivers. @@ -23513,7 +23538,8 @@ to it are lost. @end deffn @deffn {Scheme Procedure} base-initrd @var{file-systems} @ - [#:mapped-devices '()] [#:qemu-networking? #f] [#:volatile-root? #f]@ + [#:mapped-devices '()] [#:keyboard-layout #f] @ + [#:qemu-networking? #f] [#:volatile-root? #f] @ [#:linux-modules '()] Return as a file-like object a generic initrd, with kernel modules taken from @var{linux}. @var{file-systems} is a list of file-systems to be @@ -23521,6 +23547,12 @@ mounted by the initrd, possibly in addition to the root file system specified on the kernel command line via @code{--root}. @var{mapped-devices} is a list of device mappings to realize before @var{file-systems} are mounted. +When true, @var{keyboard-layout} is a @code{} record denoting +the desired console keyboard layout. This is done before @var{mapped-devices} +are set up and before @var{file-systems} are mounted such that, should the +user need to enter a passphrase or use the REPL, this happens using the +intended keyboard layout. + @var{qemu-networking?} and @var{volatile-root?} behaves as in @code{raw-initrd}. The initrd is automatically populated with all the kernel modules necessary diff --git a/gnu/build/linux-boot.scm b/gnu/build/linux-boot.scm index 44b3506284..a35d18ad7c 100644 --- a/gnu/build/linux-boot.scm +++ b/gnu/build/linux-boot.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 © 2017 Mathieu Othacehe ;;; ;;; This file is part of GNU Guix. @@ -437,6 +437,7 @@ (define (switch-root root) (define* (boot-system #:key (linux-modules '()) linux-module-directory + keymap-file qemu-guest-networking? volatile-root? pre-mount @@ -444,7 +445,8 @@ (define* (boot-system #:key (on-error 'debug)) "This procedure is meant to be called from an initrd. Boot a system by first loading LINUX-MODULES (a list of module names) from -LINUX-MODULE-DIRECTORY, then setting up QEMU guest networking if +LINUX-MODULE-DIRECTORY, then installing KEYMAP-FILE with 'loadkeys' (if +KEYMAP-FILE is true), then setting up QEMU guest networking if QEMU-GUEST-NETWORKING? is true, calling PRE-MOUNT, mounting the file systems specified in MOUNTS, and finally booting into the new root if any. The initrd supports kernel command-line options '--load', '--root', and '--repl'. @@ -491,6 +493,15 @@ (define (lookup-module name) #:lookup-module lookup-module) (map lookup-module linux-modules)) + (when keymap-file + (let ((status (system* "loadkeys" keymap-file))) + (unless (zero? status) + ;; Emit a warning rather than abort when we cannot load + ;; KEYMAP-FILE. + (format (current-error-port) + "warning: 'loadkeys' exited with status ~a~%" + status)))) + (when qemu-guest-networking? (unless (configure-qemu-networking) (display "network interface is DOWN\n"))) 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 @@ (define-record-type* operating-system (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 @@ (define make-initrd #: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." diff --git a/gnu/system/linux-initrd.scm b/gnu/system/linux-initrd.scm index 983c6d81c8..656afd1ddb 100644 --- a/gnu/system/linux-initrd.scm +++ b/gnu/system/linux-initrd.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 © 2016 Mark H Weaver ;;; Copyright © 2016 Jan Nieuwenhuizen ;;; Copyright © 2017 Mathieu Othacehe @@ -31,10 +31,13 @@ (define-module (gnu system linux-initrd) #:use-module (gnu packages disk) #:use-module (gnu packages linux) #:use-module (gnu packages guile) + #:use-module ((gnu packages xorg) + #:select (console-setup xkeyboard-config)) #:use-module ((gnu packages make-bootstrap) #:select (%guile-static-stripped)) #:use-module (gnu system file-systems) #:use-module (gnu system mapped-devices) + #:use-module (gnu system keyboard) #:use-module (ice-9 match) #:use-module (ice-9 regex) #:use-module (ice-9 vlist) @@ -139,6 +142,7 @@ (define* (raw-initrd file-systems (linux linux-libre) (linux-modules '()) (mapped-devices '()) + (keyboard-layout #f) (helper-packages '()) qemu-networking? volatile-root? @@ -152,6 +156,11 @@ (define* (raw-initrd file-systems HELPER-PACKAGES is a list of packages to be copied in the initrd. It may include e2fsck/static or other packages needed by the initrd to check root partition. +When true, KEYBOARD-LAYOUT is a record denoting the desired +console keyboard layout. This is done before MAPPED-DEVICES are set up and +before FILE-SYSTEMS are mounted such that, should the user need to enter a +passphrase or use the REPL, this happens using the intended keyboard layout. + When QEMU-NETWORKING? is true, set up networking with the standard QEMU parameters. @@ -206,6 +215,8 @@ (define kodir (and #$@device-mapping-commands)) #:linux-modules '#$linux-modules #:linux-module-directory '#$kodir + #:keymap-file #+(and=> keyboard-layout + keyboard-layout->console-keymap) #:qemu-guest-networking? #$qemu-networking? #:volatile-root? '#$volatile-root? #:on-error '#$on-error))) @@ -290,6 +301,7 @@ (define* (base-initrd file-systems (linux linux-libre) (linux-modules '()) (mapped-devices '()) + (keyboard-layout #f) qemu-networking? volatile-root? (extra-modules '()) ;deprecated @@ -300,6 +312,11 @@ (define* (base-initrd file-systems on the kernel command line via '--root'. MAPPED-DEVICES is a list of device mappings to realize before FILE-SYSTEMS are mounted. +When true, KEYBOARD-LAYOUT is a record denoting the desired +console keyboard layout. This is done before MAPPED-DEVICES are set up and +before FILE-SYSTEMS are mounted such that, should the user need to enter a +passphrase or use the REPL, this happens using the intended keyboard layout. + QEMU-NETWORKING? and VOLATILE-ROOT? behaves as in raw-initrd. The initrd is automatically populated with all the kernel modules necessary @@ -316,13 +333,18 @@ (define linux-modules* ,@extra-modules)) (define helper-packages - (file-system-packages file-systems #:volatile-root? volatile-root?)) + (append (file-system-packages file-systems + #:volatile-root? volatile-root?) + (if keyboard-layout + (list loadkeys-static) + '()))) (raw-initrd file-systems #:linux linux #:linux-modules linux-modules* #:mapped-devices mapped-devices #:helper-packages helper-packages + #:keyboard-layout keyboard-layout #:qemu-networking? qemu-networking? #:volatile-root? volatile-root? #:on-error on-error)) -- cgit v1.2.3 From 2bbb4ead771fcb29266607b338b21c6dd97e3f69 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 20 Mar 2019 22:45:44 +0100 Subject: doc: Document keyboard layout. * doc/guix.texi (Keyboard Layout): New node. (Bootloader Configuration): Remove examples and refer to it. (X Window): Add cross-reference. --- doc/guix.texi | 126 +++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 108 insertions(+), 18 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index fb3fef689a..63405bcf49 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -251,6 +251,7 @@ System Configuration * File Systems:: Configuring file system mounts. * Mapped Devices:: Block device extra processing. * User Accounts:: Specifying user accounts. +* Keyboard Layout:: How the system interprets key strokes. * Locales:: Language and cultural convention settings. * Services:: Specifying system services. * Setuid Programs:: Programs running with root privileges. @@ -10132,6 +10133,7 @@ instance to support new system services. * File Systems:: Configuring file system mounts. * Mapped Devices:: Block device extra processing. * User Accounts:: Specifying user accounts. +* Keyboard Layout:: How the system interprets key strokes. * Locales:: Language and cultural convention settings. * Services:: Specifying system services. * Setuid Programs:: Programs running with root privileges. @@ -10992,6 +10994,108 @@ Note that the ``root'' account is not included here. It is a special-case and is automatically added whether or not it is specified. @end defvr +@node Keyboard Layout +@section Keyboard Layout + +To specify what each key of your keyboard does, you need to tell the operating +system what @dfn{keyboard layout} you want to use. The default, when nothing +is specified, is the US English QWERTY layout for 105-key PC keyboards. +However, German speakers will usually prefer the German QWERTZ layout, French +speakers will want the AZERTY layout, and so on; hackers might prefer Dvorak +or bépo, and they might even want to further customize the effect of some of +the keys. This section explains how to get that done. + +@cindex keyboard layout, definition +There are three components that will want to know about your keyboard layout: + +@itemize +@item +The @emph{bootloader} may want to know what keyboard layout you want to use +(@pxref{Bootloader Configuration, @code{keyboard-layout}}). This is useful if +you want, for instance, to make sure that you can type the passphrase of your +encrypted root partition using the right layout. + +@item +The @emph{operating system kernel}, Linux, will need that so that the console +is properly configured (@pxref{operating-system Reference, +@code{keyboard-layout}}). + +@item +The @emph{graphical display server}, usually Xorg, also has its own idea of +the keyboard layout (@pxref{X Window, @code{keyboard-layout}}). +@end itemize + +Guix allows you to configure all three separately but, fortunately, it allows +you to share the same keyboard layout for all three components. + +@cindex XKB, keyboard layouts +Keyboard layouts are represented by records created by the +@code{keyboard-layout} procedure of @code{(gnu system keyboard)}. Following +the X Keyboard extension (XKB), each layout has four attributes: a name (often +a language code such as ``fi'' for Finnish or ``jp'' for Japanese), an +optional variant name, an optional keyboard model name, and a possibly empty +list of additional options. In most cases the layout name is all you care +about. Here are a few example: + +@example +;; The German QWERTZ layout. Here we assume a standard +;; "pc105" keyboard model. +(keyboard-layout "de") + +;; The bépo variant of the French layout. +(keyboard-layout "fr" "bepo") + +;; The Catalan layout. +(keyboard-layout "es" "cat") + +;; The Latin American Spanish layout. In addition, the +;; "Caps Lock" key is used as an additional "Ctrl" key, +;; and the "Menu" key is used as a "Compose" key to enter +;; accented letters. +(keyboard-layout "latam" + #:options '("ctrl:nocaps" "compose:menu")) + +;; The Russian layout for a ThinkPad keyboard. +(keyboard-layout "ru" #:model "thinkpad") + +;; The "US international" layout, which is the US layout plus +;; dead keys to enter accented characters. This is for an +;; Apple MacBook keyboard. +(keyboard-layout "us" "intl" #:model "macbook78") +@end example + +See the @file{share/X11/xkb} directory of the @code{xkeyboard-config} package +for a complete list of supported layouts, variants, and models. + +@cindex keyboard layout, configuration +Let's say you want your system to use the Turkish keyboard layout throughout +your system---bootloader, console, and Xorg. Here's what your system +configuration would look like: + +@lisp +;; Using the Turkish layout for the bootloader, the console, +;; and for Xorg. + +(operating-system + ;; ... + (keyboard-layout (keyboard-layout "tr")) ;for the console + (bootloader (bootloader-configuration + (bootloader grub-efi-bootloader) + (target "/boot/efi") + (keyboard-layout keyboard-layout))) ;for GRUB + (services (modify-services %desktop-services + (slim-service-type config => + (slim-configuration + (inherit config) + (xorg-configuration + (xorg-configuration ;for Xorg + (keyboard-layout keyboard-layout)))))))) +@end lisp + +In the example above, for GRUB and for Xorg, we just refer to the +@code{keyboard-layout} field defined above, but we could just as well refer to +a different layout. + @node Locales @section Locales @@ -13399,7 +13503,8 @@ If this is @code{#f}, Xorg uses the default keyboard layout---usually US English (``qwerty'') for a 105-key PC keyboard. Otherwise this must be a @code{keyboard-layout} object specifying the keyboard -layout in use when Xorg is running. +layout in use when Xorg is running. @xref{Keyboard Layout}, for more +information on how to specify the keyboard layout. @item @code{extra-config} (default: @code{'()}) This is a list of strings or objects appended to the configuration file. It @@ -23651,23 +23756,8 @@ The number of seconds to wait for keyboard input before booting. Set to If this is @code{#f}, the bootloader's menu (if any) uses the default keyboard layout, usually US@tie{}English (``qwerty''). -Otherwise, this must be a @code{keyboard-layout} object. For instance, the -following example defines a standard German keyboard layout: - -@example -(keyboard-layout "de") -@end example - -@noindent -while the example below designates the bépo layout for French: - -@example -(keyboard-layout "fr" "bepo") -@end example - -The layout name and variant must match an existing layout in the -@code{xkeyboard-config} package under the @file{share/X11/xkb/symbols} -directory. +Otherwise, this must be a @code{keyboard-layout} object (@pxref{Keyboard +Layout}). @quotation Note This option is currently ignored by bootloaders other than @code{grub} and -- cgit v1.2.3 From cf848cc0a17a3a58d600116896f6e7abfb0440d4 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 22 Mar 2019 14:06:54 +0100 Subject: accounts: Add default value for the 'home-directory' field of . * gnu/system/accounts.scm ()[home-directory]: Mark as thunked and add a default value. (default-home-directory): New procedure. * doc/guix.texi (User Accounts): Remove 'home-directory' from example. * gnu/system/examples/bare-bones.tmpl: Likewise. * gnu/system/examples/beaglebone-black.tmpl: Likewise. * gnu/system/examples/desktop.tmpl: Likewise. * gnu/system/examples/docker-image.tmpl: Likewise. * gnu/system/examples/lightweight-desktop.tmpl: Likewise. * gnu/system/install.scm (installation-os): Likewise. * gnu/tests.scm (%simple-os): Likewise. * gnu/tests/install.scm (%minimal-os, %minimal-os-on-vda): (%separate-home-os, %encrypted-root-os, %btrfs-root-os): Likewise. * tests/accounts.scm ("allocate-passwd") ("allocate-passwd with previous state"): Likewise. --- doc/guix.texi | 1 - gnu/system/accounts.scm | 7 ++++++- gnu/system/examples/bare-bones.tmpl | 3 +-- gnu/system/examples/beaglebone-black.tmpl | 3 +-- gnu/system/examples/desktop.tmpl | 3 +-- gnu/system/examples/docker-image.tmpl | 3 +-- gnu/system/examples/lightweight-desktop.tmpl | 3 +-- gnu/system/install.scm | 3 +-- gnu/tests.scm | 5 ++--- gnu/tests/install.scm | 14 ++++---------- tests/accounts.scm | 4 ---- 11 files changed, 18 insertions(+), 31 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 63405bcf49..37fef40522 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -10927,7 +10927,6 @@ this field must contain the encrypted password, as a string. You can use the @example (user-account (name "charlie") - (home-directory "/home/charlie") (group "users") ;; Specify a SHA-512-hashed initial password. diff --git a/gnu/system/accounts.scm b/gnu/system/accounts.scm index eb18fb5e43..586cff1842 100644 --- a/gnu/system/accounts.scm +++ b/gnu/system/accounts.scm @@ -67,7 +67,8 @@ (define-record-type* (supplementary-groups user-account-supplementary-groups (default '())) ; list of strings (comment user-account-comment (default "")) - (home-directory user-account-home-directory) + (home-directory user-account-home-directory (thunked) + (default (default-home-directory this-record))) (create-home-directory? user-account-create-home-directory? ;Boolean (default #t)) (shell user-account-shell ; gexp @@ -84,6 +85,10 @@ (define-record-type* (system? user-group-system? ; Boolean (default #f))) +(define (default-home-directory account) + "Return the default home directory for ACCOUNT." + (string-append "/home/" (user-account-name account))) + (define (sexp->user-group sexp) "Take SEXP, a tuple as returned by 'user-group->gexp', and turn it into a user-group record." diff --git a/gnu/system/examples/bare-bones.tmpl b/gnu/system/examples/bare-bones.tmpl index a88bab034f..4f30a5b756 100644 --- a/gnu/system/examples/bare-bones.tmpl +++ b/gnu/system/examples/bare-bones.tmpl @@ -35,8 +35,7 @@ ;; and "video" allows the user to play sound ;; and access the webcam. (supplementary-groups '("wheel" - "audio" "video")) - (home-directory "/home/alice")) + "audio" "video"))) %base-user-accounts)) ;; Globally-installed packages. diff --git a/gnu/system/examples/beaglebone-black.tmpl b/gnu/system/examples/beaglebone-black.tmpl index 11678063b2..def05e807d 100644 --- a/gnu/system/examples/beaglebone-black.tmpl +++ b/gnu/system/examples/beaglebone-black.tmpl @@ -38,8 +38,7 @@ ;; and "video" allows the user to play sound ;; and access the webcam. (supplementary-groups '("wheel" - "audio" "video")) - (home-directory "/home/alice")) + "audio" "video"))) %base-user-accounts)) ;; Globally-installed packages. diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl index c59bf92681..bc5cbd6e6b 100644 --- a/gnu/system/examples/desktop.tmpl +++ b/gnu/system/examples/desktop.tmpl @@ -42,8 +42,7 @@ (comment "Alice's brother") (group "users") (supplementary-groups '("wheel" "netdev" - "audio" "video")) - (home-directory "/home/bob")) + "audio" "video"))) %base-user-accounts)) ;; This is where we specify system-wide packages. diff --git a/gnu/system/examples/docker-image.tmpl b/gnu/system/examples/docker-image.tmpl index 9690d651c1..ca633cc838 100644 --- a/gnu/system/examples/docker-image.tmpl +++ b/gnu/system/examples/docker-image.tmpl @@ -15,8 +15,7 @@ (comment "Bob's sister") (group "users") (supplementary-groups '("wheel" - "audio" "video")) - (home-directory "/home/alice")) + "audio" "video"))) %base-user-accounts)) ;; Globally-installed packages. diff --git a/gnu/system/examples/lightweight-desktop.tmpl b/gnu/system/examples/lightweight-desktop.tmpl index a234badd2b..45d9bf447f 100644 --- a/gnu/system/examples/lightweight-desktop.tmpl +++ b/gnu/system/examples/lightweight-desktop.tmpl @@ -35,8 +35,7 @@ (comment "Bob's sister") (group "users") (supplementary-groups '("wheel" "netdev" - "audio" "video")) - (home-directory "/home/alice")) + "audio" "video"))) %base-user-accounts)) ;; Add a bunch of window managers; we can choose one at diff --git a/gnu/system/install.scm b/gnu/system/install.scm index bad318d06b..aad1deb913 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -379,8 +379,7 @@ (define installation-os (group "users") (supplementary-groups '("wheel")) ; allow use of sudo (password "") - (comment "Guest of GNU") - (home-directory "/home/guest")))) + (comment "Guest of GNU")))) (issue %issue) (services %installation-services) diff --git a/gnu/tests.scm b/gnu/tests.scm index 9e8eed7d95..0871b4c6f7 100644 --- a/gnu/tests.scm +++ b/gnu/tests.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2016, 2017, 2018 Ludovic Courtès +;;; Copyright © 2016, 2017, 2018, 2019 Ludovic Courtès ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2017 Tobias Geerinckx-Rice ;;; @@ -219,8 +219,7 @@ (define %simple-os (name "alice") (comment "Bob's sister") (group "users") - (supplementary-groups '("wheel" "audio" "video")) - (home-directory "/home/alice")) + (supplementary-groups '("wheel" "audio" "video"))) %base-user-accounts)))) (define-syntax-rule (simple-operating-system user-services ...) diff --git a/gnu/tests/install.scm b/gnu/tests/install.scm index 277908cc49..c0debbd840 100644 --- a/gnu/tests/install.scm +++ b/gnu/tests/install.scm @@ -74,8 +74,7 @@ (define-os-with-source (%minimal-os %minimal-os-source) (name "alice") (comment "Bob's sister") (group "users") - (supplementary-groups '("wheel" "audio" "video")) - (home-directory "/home/alice")) + (supplementary-groups '("wheel" "audio" "video"))) %base-user-accounts)) (services (cons (service marionette-service-type (marionette-configuration @@ -357,8 +356,7 @@ (define-os-with-source (%minimal-os-on-vda %minimal-os-on-vda-source) (name "alice") (comment "Bob's sister") (group "users") - (supplementary-groups '("wheel" "audio" "video")) - (home-directory "/home/alice")) + (supplementary-groups '("wheel" "audio" "video"))) %base-user-accounts)) (services (cons (service marionette-service-type (marionette-configuration @@ -435,12 +433,10 @@ (define-os-with-source (%separate-home-os %separate-home-os-source) %base-file-systems)) (users (cons* (user-account (name "alice") - (group "users") - (home-directory "/home/alice")) + (group "users")) (user-account (name "charlie") - (group "users") - (home-directory "/home/charlie")) + (group "users")) %base-user-accounts)) (services (cons (service marionette-service-type (marionette-configuration @@ -655,7 +651,6 @@ (define-os-with-source (%encrypted-root-os %encrypted-root-os-source) (users (cons (user-account (name "charlie") (group "users") - (home-directory "/home/charlie") (supplementary-groups '("wheel" "audio" "video"))) %base-user-accounts)) (services (cons (service marionette-service-type @@ -776,7 +771,6 @@ (define-os-with-source (%btrfs-root-os %btrfs-root-os-source) (users (cons (user-account (name "charlie") (group "users") - (home-directory "/home/charlie") (supplementary-groups '("wheel" "audio" "video"))) %base-user-accounts)) (services (cons (service marionette-service-type diff --git a/tests/accounts.scm b/tests/accounts.scm index 127861042d..923ba7dc83 100644 --- a/tests/accounts.scm +++ b/tests/accounts.scm @@ -199,12 +199,10 @@ (define allocate-passwd (@@ (gnu build accounts) allocate-passwd)) (directory "/var/empty"))) (allocate-passwd (list (user-account (name "alice") (comment "Alice") - (home-directory "/home/alice") (shell "/bin/sh") (group "users")) (user-account (name "bob") (comment "Bob") - (home-directory "/home/bob") (shell "/bin/gash") (group "wheel")) (user-account (name "sshd") (system? #t) @@ -234,12 +232,10 @@ (define allocate-passwd (@@ (gnu build accounts) allocate-passwd)) (directory "/home/charlie"))) (allocate-passwd (list (user-account (name "alice") (comment "Alice") - (home-directory "/home/alice") (shell "/bin/sh") ;ignored (group "users")) (user-account (name "charlie") (comment "Charlie") - (home-directory "/home/charlie") (shell "/bin/sh") (group "users"))) (list (group-entry (name "users") (gid 1000))) -- cgit v1.2.3 From 69cae3d3356a69b7fe69481338f760545995485e Mon Sep 17 00:00:00 2001 From: Ludovic Courtès 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'. --- doc/guix.texi | 7 ++++ gnu/system.scm | 73 +++++++++++++++++++----------------------- gnu/system/linux-container.scm | 69 ++++++++++++++++++++++++--------------- gnu/system/vm.scm | 13 ++++---- 4 files changed, 90 insertions(+), 72 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 37fef40522..7d80c00530 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -10531,6 +10531,13 @@ details. @item @code{services} (default: @var{%base-services}) A list of service objects denoting system services. @xref{Services}. +@cindex essential services +@item @code{essential-services} (default: ...) +The list of ``essential services''---i.e., things like instances of +@code{system-service-type} and @code{host-name-service-type} (@pxref{Service +Reference}), which are derived from the operating system definition itself. +As a user you should @emph{never} need to touch this field. + @item @code{pam-services} (default: @code{(base-pam-services)}) @cindex PAM @cindex pluggable authentication modules 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 @@ (define-module (gnu system) 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 @@ (define-record-type* operating-system (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 @@ (define (operating-system-kernel-file 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 @@ (define known-fs (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 @@ (define known-fs 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 @@ (define %sudoers-specification 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 @@ (define (operating-system-shepherd-service-names os) #: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 diff --git a/gnu/system/linux-container.scm b/gnu/system/linux-container.scm index 3fe3482d7f..37a053cdc3 100644 --- a/gnu/system/linux-container.scm +++ b/gnu/system/linux-container.scm @@ -29,12 +29,31 @@ (define-module (gnu system linux-container) #:use-module (gnu build linux-container) #:use-module (gnu services) #:use-module (gnu services base) + #:use-module (gnu services shepherd) #:use-module (gnu system) #:use-module (gnu system file-systems) #:export (system-container containerized-operating-system container-script)) +(define (container-essential-services os) + "Return a list of essential services corresponding to OS, a +non-containerized OS. This procedure essentially strips essential services +from OS that are needed on the bare metal and not in a container." + (define base + (remove (lambda (service) + (memq (service-kind service) + (list (service-kind %linux-bare-metal-service) + firmware-service-type + system-service-type))) + (operating-system-essential-services os))) + + (cons (service system-service-type + (let ((locale (operating-system-locale-directory os))) + (with-monad %store-monad + (return `(("locale" ,locale)))))) + (append base (list %containerized-shepherd-service)))) + (define (containerized-operating-system os mappings) "Return an operating system based on OS for use in a Linux container environment. MAPPINGS is a list of to realize in the @@ -62,8 +81,10 @@ (define useless-services mingetty-service-type agetty-service-type)) - (operating-system (inherit os) + (operating-system + (inherit os) (swap-devices '()) ; disable swap + (essential-services (container-essential-services os)) (services (remove (lambda (service) (memq (service-kind service) useless-services)) @@ -81,30 +102,26 @@ (define* (container-script os #:key (mappings '())) (operating-system-file-systems os))) (specs (map file-system->spec file-systems))) - (mlet* %store-monad ((os-drv (operating-system-derivation - os - #:container? #t))) - - (define script - (with-imported-modules (source-module-closure - '((guix build utils) - (gnu build linux-container))) - #~(begin - (use-modules (gnu build linux-container) - (gnu system file-systems) ;spec->file-system - (guix build utils)) + (define script + (with-imported-modules (source-module-closure + '((guix build utils) + (gnu build linux-container))) + #~(begin + (use-modules (gnu build linux-container) + (gnu system file-systems) ;spec->file-system + (guix build utils)) - (call-with-container (map spec->file-system '#$specs) - (lambda () - (setenv "HOME" "/root") - (setenv "TMPDIR" "/tmp") - (setenv "GUIX_NEW_SYSTEM" #$os-drv) - (for-each mkdir-p '("/run" "/bin" "/etc" "/home" "/var")) - (primitive-load (string-append #$os-drv "/boot"))) - ;; A range of 65536 uid/gids is used to cover 16 bits worth of - ;; users and groups, which is sufficient for most cases. - ;; - ;; See: http://www.freedesktop.org/software/systemd/man/systemd-nspawn.html#--private-users= - #:host-uids 65536)))) + (call-with-container (map spec->file-system '#$specs) + (lambda () + (setenv "HOME" "/root") + (setenv "TMPDIR" "/tmp") + (setenv "GUIX_NEW_SYSTEM" #$os) + (for-each mkdir-p '("/run" "/bin" "/etc" "/home" "/var")) + (primitive-load (string-append #$os "/boot"))) + ;; A range of 65536 uid/gids is used to cover 16 bits worth of + ;; users and groups, which is sufficient for most cases. + ;; + ;; See: http://www.freedesktop.org/software/systemd/man/systemd-nspawn.html#--private-users= + #:host-uids 65536)))) - (gexp->script "run-container" script)))) + (gexp->script "run-container" script))) diff --git a/gnu/system/vm.scm b/gnu/system/vm.scm index 5068cb3068..667624621f 100644 --- a/gnu/system/vm.scm +++ b/gnu/system/vm.scm @@ -58,6 +58,7 @@ (define-module (gnu system vm) #:use-module (gnu bootloader grub) #:use-module (gnu system shadow) #:use-module (gnu system pam) + #:use-module (gnu system linux-container) #:use-module (gnu system linux-initrd) #:use-module (gnu bootloader) #:use-module (gnu system file-systems) @@ -473,9 +474,9 @@ (define schema (local-file (search-path %load-path "guix/store/schema.sql")))) - (mlet %store-monad ((os-drv (operating-system-derivation os #:container? #t)) - (name -> (string-append name ".tar.gz")) - (graph -> "system-graph")) + (let ((os (containerized-operating-system os '())) + (name (string-append name ".tar.gz")) + (graph "system-graph")) (define build (with-extensions (cons guile-json ;for (guix docker) gcrypt-sqlite3&co) ;for (guix store database) @@ -505,7 +506,7 @@ (define build (initialize (root-partition-initializer #:closures '(#$graph) #:register-closures? #$register-closures? - #:system-directory #$os-drv + #:system-directory #$os ;; De-duplication would fail due to ;; cross-device link errors, so don't do it. #:deduplicate? #f)) @@ -523,7 +524,7 @@ (define build (call-with-input-file (string-append "/xchg/" #$graph) read-reference-graph))) - #$os-drv + #$os #:compressor '(#+(file-append gzip "/bin/gzip") "-9n") #:creation-time (make-time time-utc 0 1) #:transformations `((,root-directory -> ""))) @@ -534,7 +535,7 @@ (define build name build #:make-disk-image? #f #:single-file-output? #t - #:references-graphs `((,graph ,os-drv))))) + #:references-graphs `((,graph ,os))))) ;;; -- cgit v1.2.3 From ee05cc7fe353c1c9b45062343746ac215a29fed5 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 27 Mar 2019 10:14:11 +0100 Subject: services: Deprecate 'gnome-desktop-service'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/services/desktop.scm (gnome-desktop-service-type)[default-value]: New field. (gnome-desktop-service): Deprecate. * gnu/installer/services.scm (%desktop-environments): Use the (service …) form for GNOME. * gnu/system/examples/desktop.tmpl: Likewise. * doc/guix.texi (Desktop Services): Adjust accordingly. --- doc/guix.texi | 28 ++++++++++++++++++++-------- gnu/installer/services.scm | 2 +- gnu/services/desktop.scm | 5 ++++- gnu/system/examples/desktop.tmpl | 2 +- 4 files changed, 26 insertions(+), 11 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 7d80c00530..d99b7fd933 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -14420,7 +14420,7 @@ The @var{%desktop-services} variable can be used as the @code{services} field of an @code{operating-system} declaration (@pxref{operating-system Reference, @code{services}}). -Additionally, the @code{gnome-desktop-service}, +Additionally, the @code{gnome-desktop-service-type}, @code{xfce-desktop-service}, @code{mate-desktop-service-type} and @code{enlightenment-desktop-service-type} procedures can add GNOME, XFCE, MATE and/or Enlightenment to a system. To ``add GNOME'' means that system-level @@ -14428,7 +14428,7 @@ services like the backlight adjustment helpers and the power management utilities are added to the system, extending @code{polkit} and @code{dbus} appropriately, allowing GNOME to operate with elevated privileges on a limited number of special-purpose system interfaces. Additionally, -adding a service made by @code{gnome-desktop-service} adds the GNOME +adding a service made by @code{gnome-desktop-service-type} adds the GNOME metapackage to the system profile. Likewise, adding the XFCE service not only adds the @code{xfce} metapackage to the system profile, but it also gives the Thunar file manager the ability to open a ``root-mode'' @@ -14452,11 +14452,23 @@ also try starting GNOME on Wayland manually from a TTY with the command ``XDG_SESSION_TYPE=wayland exec dbus-run-session gnome-session``. Currently only GNOME has support for Wayland. -@deffn {Scheme Procedure} gnome-desktop-service -Return a service that adds the @code{gnome} package to the system -profile, and extends polkit with the actions from -@code{gnome-settings-daemon}. -@end deffn +@defvr {Scheme Variable} gnome-desktop-service-type +This is the type of the service that adds the @uref{https://www.gnome.org, +GNOME} desktop environment. Its value is a @code{gnome-desktop-configuration} +object (see below.) + +This service adds the @code{gnome} package to the system profile, and extends +polkit with the actions from @code{gnome-settings-daemon}. +@end defvr + +@deftp {Data Type} gnome-desktop-configuration +Configuration record for the GNOME desktop environment. + +@table @asis +@item @code{gnome} (default @code{gnome}) +The GNOME package to use. +@end table +@end deftp @deffn {Scheme Procedure} xfce-desktop-service Return a service that adds the @code{xfce} package to the system profile, @@ -14508,7 +14520,7 @@ them by default. To add GNOME, XFCE or MATE, just @code{cons} them onto (operating-system ... ;; cons* adds items to the list given as its last argument. - (services (cons* (gnome-desktop-service) + (services (cons* (service gnome-desktop-service-type) (xfce-desktop-service) %desktop-services)) ...) diff --git a/gnu/installer/services.scm b/gnu/installer/services.scm index f263ecc84f..e719da083d 100644 --- a/gnu/installer/services.scm +++ b/gnu/installer/services.scm @@ -38,7 +38,7 @@ (define %desktop-environments (list (desktop-environment (name "GNOME") - (snippet '(gnome-desktop-service))) + (snippet '(service gnome-desktop-service-type))) (desktop-environment (name "Xfce") (snippet '(xfce-desktop-service))) diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index b912c208cc..9c9472e1a2 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -884,9 +884,12 @@ (define gnome-desktop-service-type (service-extension profile-service-type (compose list gnome-package)))) + (default-value (gnome-desktop-configuration)) (description "Run the GNOME desktop environment."))) -(define* (gnome-desktop-service #:key (config (gnome-desktop-configuration))) +(define-deprecated (gnome-desktop-service #:key (config + (gnome-desktop-configuration))) + gnome-desktop-service-type "Return a service that adds the @code{gnome} package to the system profile, and extends polkit with the actions from @code{gnome-settings-daemon}." (service gnome-desktop-service-type config)) diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl index bc5cbd6e6b..fe32bc58b5 100644 --- a/gnu/system/examples/desktop.tmpl +++ b/gnu/system/examples/desktop.tmpl @@ -57,7 +57,7 @@ ;; screen with F1. Use the "desktop" services, which ;; include the X11 log-in service, networking with ;; NetworkManager, and more. - (services (append (list (gnome-desktop-service) + (services (append (list (service gnome-desktop-service-type) (xfce-desktop-service)) %desktop-services)) -- cgit v1.2.3 From 391e0d65d7129d53c025963d2758724e75626eb4 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 27 Mar 2019 10:41:14 +0100 Subject: services: Deprecate 'xfce-desktop-service'. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/services/desktop.scm (xfce-desktop-service-type)[default-value] [description]: New fields. (xfce-desktop-service): Deprecate. * gnu/system/examples/desktop.tmpl: Use the (service …) form. * gnu/installer/services.scm (%desktop-environments): Add TODO comment. * doc/guix.texi (Desktop Services): Adjust accordingly, and fix spelling of "Xfce" throughout. --- doc/guix.texi | 37 +++++++++++++++++++++++++------------ gnu/installer/services.scm | 2 ++ gnu/services/desktop.scm | 9 ++++++--- gnu/system/examples/desktop.tmpl | 2 +- 4 files changed, 34 insertions(+), 16 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index d99b7fd933..1bbed7a72d 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -14395,7 +14395,7 @@ The @code{(gnu services desktop)} module provides services that are usually useful in the context of a ``desktop'' setup---that is, on a machine running a graphical display server, possibly with graphical user interfaces, etc. It also defines services that provide specific desktop -environments like GNOME, XFCE or MATE. +environments like GNOME, Xfce or MATE. To simplify things, the module defines a variable containing the set of services that users typically expect on a machine with a graphical @@ -14422,14 +14422,14 @@ Reference, @code{services}}). Additionally, the @code{gnome-desktop-service-type}, @code{xfce-desktop-service}, @code{mate-desktop-service-type} and -@code{enlightenment-desktop-service-type} procedures can add GNOME, XFCE, MATE +@code{enlightenment-desktop-service-type} procedures can add GNOME, Xfce, MATE and/or Enlightenment to a system. To ``add GNOME'' means that system-level services like the backlight adjustment helpers and the power management utilities are added to the system, extending @code{polkit} and @code{dbus} appropriately, allowing GNOME to operate with elevated privileges on a limited number of special-purpose system interfaces. Additionally, adding a service made by @code{gnome-desktop-service-type} adds the GNOME -metapackage to the system profile. Likewise, adding the XFCE service +metapackage to the system profile. Likewise, adding the Xfce service not only adds the @code{xfce} metapackage to the system profile, but it also gives the Thunar file manager the ability to open a ``root-mode'' file management window, if the user authenticates using the @@ -14470,12 +14470,25 @@ The GNOME package to use. @end table @end deftp -@deffn {Scheme Procedure} xfce-desktop-service -Return a service that adds the @code{xfce} package to the system profile, -and extends polkit with the ability for @code{thunar} to manipulate the -file system as root from within a user session, after the user has -authenticated with the administrator's password. -@end deffn +@defvr {Scheme Variable} xfce-desktop-service-type +This is the type of a service to run the @uref{Xfce, https://xfce.org/} +desktop environment. Its value is an @code{xfce-desktop-configuration} object +(see below.) + +This service that adds the @code{xfce} package to the system profile, and +extends polkit with the ability for @code{thunar} to manipulate the file +system as root from within a user session, after the user has authenticated +with the administrator's password. +@end defvr + +@deftp {Data Type} xfce-desktop-configuration +Configuration record for the Xfce desktop environment. + +@table @asis +@item @code{xfce} (default @code{xfce}) +The Xfce package to use. +@end table +@end deftp @deffn {Scheme Variable} mate-desktop-service-type This is the type of the service that runs the @uref{https://mate-desktop.org/, @@ -14508,9 +14521,9 @@ The enlightenment package to use. @end table @end deftp -Because the GNOME, XFCE and MATE desktop services pull in so many packages, +Because the GNOME, Xfce and MATE desktop services pull in so many packages, the default @code{%desktop-services} variable doesn't include any of -them by default. To add GNOME, XFCE or MATE, just @code{cons} them onto +them by default. To add GNOME, Xfce or MATE, just @code{cons} them onto @code{%desktop-services} in the @code{services} field of your @code{operating-system}: @@ -14521,7 +14534,7 @@ them by default. To add GNOME, XFCE or MATE, just @code{cons} them onto ... ;; cons* adds items to the list given as its last argument. (services (cons* (service gnome-desktop-service-type) - (xfce-desktop-service) + (service xfce-desktop-service) %desktop-services)) ...) @end example diff --git a/gnu/installer/services.scm b/gnu/installer/services.scm index e719da083d..2b6625f6af 100644 --- a/gnu/installer/services.scm +++ b/gnu/installer/services.scm @@ -41,6 +41,8 @@ (define %desktop-environments (snippet '(service gnome-desktop-service-type))) (desktop-environment (name "Xfce") + ;; TODO: Use 'xfce-desktop-service-type' when the 'guix' package provides + ;; it with a default value. (snippet '(xfce-desktop-service))) (desktop-environment (name "MATE") diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index 9c9472e1a2..da6291036f 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -945,10 +945,13 @@ (define xfce-desktop-service-type "thunar") xfce-package)) (service-extension profile-service-type - (compose list - xfce-package)))))) + (compose list xfce-package)))) + (default-value (xfce-desktop-configuration)) + (description "Run the Xfce desktop environment."))) -(define* (xfce-desktop-service #:key (config (xfce-desktop-configuration))) +(define-deprecated (xfce-desktop-service #:key (config + (xfce-desktop-configuration))) + xfce-desktop-service-type "Return a service that adds the @code{xfce} package to the system profile, and extends polkit with the ability for @code{thunar} to manipulate the file system as root from within a user session, after the user has authenticated diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl index fe32bc58b5..d0e3ff56e8 100644 --- a/gnu/system/examples/desktop.tmpl +++ b/gnu/system/examples/desktop.tmpl @@ -58,7 +58,7 @@ ;; include the X11 log-in service, networking with ;; NetworkManager, and more. (services (append (list (service gnome-desktop-service-type) - (xfce-desktop-service)) + (service xfce-desktop-service)) %desktop-services)) ;; Allow resolution of '.local' host names with mDNS. -- cgit v1.2.3 From 357b287b8f083e8b078da4a3246e0bad4ef199ac Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 28 Mar 2019 23:03:11 +0100 Subject: services: desktop: Switch to GDM. * gnu/services/desktop.scm (%desktop-services): Replace SLIM-SERVICE-TYPE instance with an instance of GDM-SERVICE-TYPE. * doc/guix.texi (Keyboard Layout): Change example to mention GDM-SERVICE-TYPE. (X Window): Mention GDM. (Desktop Services): Adjust references to SLiM. --- doc/guix.texi | 18 ++++++++++++------ gnu/services/desktop.scm | 2 +- 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 1bbed7a72d..525b8f424f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11090,8 +11090,8 @@ configuration would look like: (target "/boot/efi") (keyboard-layout keyboard-layout))) ;for GRUB (services (modify-services %desktop-services - (slim-service-type config => - (slim-configuration + (gdm-service-type config => + (gdm-configuration (inherit config) (xorg-configuration (xorg-configuration ;for Xorg @@ -13294,7 +13294,13 @@ Package object of the Open vSwitch. Support for the X Window graphical display system---specifically Xorg---is provided by the @code{(gnu services xorg)} module. Note that there is no @code{xorg-service} procedure. Instead, the X server is -started by the @dfn{login manager}, by default SLiM. +started by the @dfn{login manager}, by default the GNOME Display Manager (GDM). + +@cindex GDM +@cindex GNOME, login manager +GDM of course allows users to log in into window managers and desktop +environments other than GNOME; for those using GNOME, GDM is required for +features such as automatic screen locking. @cindex window manager To use X11, you must install at least one @dfn{window manager}---for @@ -14406,7 +14412,7 @@ This is a list of services that builds upon @var{%base-services} and adds or adjusts services for a typical ``desktop'' setup. In particular, it adds a graphical login manager (@pxref{X Window, -@code{slim-service}}), screen lockers, a network management tool +@code{gdm-service-type}}), screen lockers, a network management tool (@pxref{Networking Services, @code{network-manager-service-type}}), energy and color management services, the @code{elogind} login and seat manager, the Polkit privilege service, the GeoClue location service, the @@ -14445,8 +14451,8 @@ functionality to work as expetected. The desktop environments in Guix use the Xorg display server by default. If you'd like to use the newer display server protocol -called Wayland, you need to use the @code{sddm-service} instead of the -@code{slim-service} for the graphical login manager. You should then +called Wayland, you need to use the @code{sddm-service} instead of +GDM as the graphical login manager. You should then select the ``GNOME (Wayland)'' session in SDDM. Alternatively you can also try starting GNOME on Wayland manually from a TTY with the command ``XDG_SESSION_TYPE=wayland exec dbus-run-session diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index da6291036f..dcab950822 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -1078,7 +1078,7 @@ (define inputattach-service-type (define %desktop-services ;; List of services typically useful for a "desktop" use case. - (cons* (service slim-service-type) + (cons* (service gdm-service-type) ;; Screen lockers are a pretty useful thing and these are small. (screen-locker-service slock) -- cgit v1.2.3 From 46fc7cafcf7dcaaa252591df387541d43df05bb9 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 29 Mar 2019 15:34:12 +0100 Subject: doc: Fix invalid uses of @ref. * doc/guix.texi (Invoking guix pull): Use @xref instead of @ref at the beginning of sentences. --- doc/guix.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 525b8f424f..d6dda9904c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3621,7 +3621,7 @@ Generation 3 Jun 13 2018 23:31:07 (current) 69 packages upgraded: borg@@1.1.6, cheese@@3.28.0, @dots{} @end example -@ref{Invoking guix describe, @command{guix describe}}, for other ways to +@xref{Invoking guix describe, @command{guix describe}}, for other ways to describe the current status of Guix. This @code{~/.config/guix/current} profile works like any other profile @@ -3666,7 +3666,7 @@ is provided, the subset of generations that match @var{pattern}. The syntax of @var{pattern} is the same as with @code{guix package --list-generations} (@pxref{Invoking guix package}). -@ref{Invoking guix describe}, for a way to display information about the +@xref{Invoking guix describe}, for a way to display information about the current generation only. @item --profile=@var{profile} -- cgit v1.2.3 From a7646bc5e17a829d23519d0b199a576fb1edbd04 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 30 Mar 2019 14:59:26 +0100 Subject: packages: Remove 'self-native-input?' field. This field has become unnecessary with the addition of 'this-package'. * guix/packages.scm ()[self-native-input?]: Remove. (package->bag): Adjust accordingly. * doc/guix.texi (package Reference): Remove 'self-native-input?'. --- doc/guix.texi | 4 ---- guix/packages.scm | 11 ++--------- 2 files changed, 2 insertions(+), 13 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index d6dda9904c..527f9bcd10 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5361,10 +5361,6 @@ more. To ensure that libraries written in those languages can find library code they depend on at run time, run-time dependencies must be listed in @code{propagated-inputs} rather than @code{inputs}. -@item @code{self-native-input?} (default: @code{#f}) -This is a Boolean field telling whether the package should use itself as -a native input when cross-compiling. - @item @code{outputs} (default: @code{'("out")}) The list of output names of the package. @xref{Packages with Multiple Outputs}, for typical uses of additional outputs. diff --git a/guix/packages.scm b/guix/packages.scm index b402637508..1d3d99ba65 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -264,9 +264,6 @@ (define-record-type* (default '()) (thunked)) (native-inputs package-native-inputs ; native input packages/derivations (default '()) (thunked)) - (self-native-input? package-self-native-input? ; whether to use itself as - ; a native input when cross- - (default #f)) ; compiling (outputs package-outputs ; list of strings (default '("out"))) @@ -1032,7 +1029,7 @@ (define* (package->bag package #:optional ((and self ($ name version source build-system args inputs propagated-inputs native-inputs - self-native-input? outputs)) + outputs)) ;; Even though we prefer to use "@" to separate the package ;; name from the package version in various user-facing parts ;; of Guix, checkStoreName (in nix/libstore/store-api.cc) @@ -1044,11 +1041,7 @@ (define* (package->bag package #:optional #:inputs (append (inputs self) (propagated-inputs self)) #:outputs outputs - #:native-inputs `(,@(if (and target - self-native-input?) - `(("self" ,self)) - '()) - ,@(native-inputs self)) + #:native-inputs (native-inputs self) #:arguments (args self)) (raise (if target (condition -- cgit v1.2.3 From 631a6e63777dd2e08fe5bdc75908e6c030abcd1f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 31 Mar 2019 23:13:51 +0200 Subject: doc: Document 'gdm-service-type'. * doc/guix.texi (X Window): Document 'gdm-service-type' and 'gdm-configuration'. Take description of '.desktop' files from the 'slim-service-type' description. * gnu/services/xorg.scm (gdm-service): Remove outdated comment. --- doc/guix.texi | 52 +++++++++++++++++++++++++++++++++++++++++++-------- gnu/services/xorg.scm | 3 --- 2 files changed, 44 insertions(+), 11 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 527f9bcd10..616970b505 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -13304,23 +13304,59 @@ example the @code{windowmaker} or @code{openbox} packages---preferably by adding it to the @code{packages} field of your operating system definition (@pxref{operating-system Reference, system-wide packages}). -@defvr {Scheme Variable} slim-service-type -This is the type for the SLiM graphical login manager for X11. +@defvr {Scheme Variable} gdm-service-type +This is the type for the @uref{https://wiki.gnome.org/Projects/GDM/, GNOME +Desktop Manager} (GDM), a program that manages graphical display servers and +handles graphical user logins. Its value must be a @code{gdm-configuration} +(see below.) @cindex session types (X11) @cindex X11 session types -SLiM looks for @dfn{session types} described by the @file{.desktop} files in -@file{/run/current-system/profile/share/xsessions} and allows users to -choose a session from the log-in screen using @kbd{F1}. Packages such -as @code{xfce}, @code{sawfish}, and @code{ratpoison} provide -@file{.desktop} files; adding them to the system-wide set of packages -automatically makes them available at the log-in screen. +GDM looks for @dfn{session types} described by the @file{.desktop} files in +@file{/run/current-system/profile/share/xsessions} and allows users to choose +a session from the log-in screen. Packages such as @code{gnome}, @code{xfce}, +and @code{i3} provide @file{.desktop} files; adding them to the system-wide +set of packages automatically makes them available at the log-in screen. In addition, @file{~/.xsession} files are honored. When available, @file{~/.xsession} must be an executable that starts a window manager and/or other X clients. @end defvr +@deftp {Data Type} gdm-configuration +@table @asis +@item @code{auto-login?} (default: @code{#f}) +@itemx @code{default-user} (default: @code{#f}) +When @code{auto-login?} is false, GDM presents a log-in screen. + +When @code{auto-login?} is true, GDM logs in directly as +@code{default-user}. + +@item @code{gnome-shell-assets} (default: ...) +List of GNOME Shell assets needed by GDM: icon theme, fonts, etc. + +@item @code{xorg-configuration} (default: @code{(xorg-configuration)}) +Configuration of the Xorg graphical server. + +@item @code{xsession} (default: @code{(xinitrc)}) +Script to run before starting a X session. + +@item @code{dbus-daemon} (default: @code{dbus-daemon-wrapper}) +File name of the @code{dbus-daemon} executable. + +@item @code{gdm} (default: @code{gdm}) +The GDM package to use. +@end table +@end deftp + +@defvr {Scheme Variable} slim-service-type +This is the type for the SLiM graphical login manager for X11. + +Like GDM, SLiM looks for session types described by @file{.desktop} files and +allows users to choose a session from the log-in screen using @kbd{F1}. It +also honors @file{~/.xsession} files. +@end defvr + @deftp {Data Type} slim-configuration Data type representing the configuration of @code{slim-service-type}. diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index f047b8a043..6cbd1fd722 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -791,9 +791,6 @@ (define gdm-service-type "Run the GNOME Desktop Manager (GDM), a program that allows you to log in in a graphical session, whether or not you use GNOME."))) -;; This service isn't working yet; it gets as far as starting to run the -;; greeter from gnome-shell but doesn't get any further. It is here because -;; it doesn't hurt anyone and perhaps it inspires someone to fix it :) (define-deprecated (gdm-service #:key (gdm gdm) (allow-empty-passwords? #t) (x-server (xorg-wrapper))) -- cgit v1.2.3 From 1ccc0f807d3f22fa9ade1c607c112e04df833a72 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 2 Apr 2019 10:57:24 +0200 Subject: environment: '-C' creates namespaces where the user is not root. * guix/scripts/environment.scm (launch-environment/container): Add UID and GID. Use them in PASSWD and GROUPS. Pass them as #:guest-uid and #:guest-gid to 'call-with-container'. * tests/guix-environment-container.sh: Test the inner UID. In '--user' test, replace hard-coded 0 with 1000. * doc/guix.texi (Invoking guix environment): Adjust accordingly. --- doc/guix.texi | 13 ++++++++----- guix/scripts/environment.scm | 8 ++++++-- tests/guix-environment-container.sh | 15 ++++++++++++++- 3 files changed, 28 insertions(+), 8 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 616970b505..616c2ef305 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -4557,9 +4557,11 @@ Run @var{command} within an isolated container. The current working directory outside the container is mapped inside the container. Additionally, unless overridden with @code{--user}, a dummy home directory is created that matches the current user's home directory, and -@file{/etc/passwd} is configured accordingly. The spawned process runs -as the current user outside the container, but has root privileges in -the context of the container. +@file{/etc/passwd} is configured accordingly. + +The spawned process runs as the current user outside the container. Inside +the container, it has the same UID and GID as the current user, unless +@option{--user} is passed (see below.) @item --network @itemx -N @@ -4587,8 +4589,9 @@ the environment. @itemx -u @var{user} For containers, use the username @var{user} in place of the current user. The generated @file{/etc/passwd} entry within the container will -contain the name @var{user}; the home directory will be -@file{/home/USER}; and no user GECOS data will be copied. @var{user} +contain the name @var{user}, the home directory will be +@file{/home/@var{user}}, and no user GECOS data will be copied. Furthermore, +the UID and GID inside the container are 1000. @var{user} need not exist on the system. Additionally, any shared or exposed path (see @code{--share} and diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm index c27edc7982..2d1ba4c938 100644 --- a/guix/scripts/environment.scm +++ b/guix/scripts/environment.scm @@ -459,17 +459,19 @@ (define* (launch-environment/container #:key command bash user user-mappings (return (let* ((cwd (getcwd)) (home (getenv "HOME")) + (uid (if user 1000 (getuid))) + (gid (if user 1000 (getgid))) (passwd (let ((pwd (getpwuid (getuid)))) (password-entry (name (or user (passwd:name pwd))) (real-name (if user "" (passwd:gecos pwd))) - (uid 0) (gid 0) (shell bash) + (uid uid) (gid gid) (shell bash) (directory (if user (string-append "/home/" user) (passwd:dir pwd)))))) - (groups (list (group-entry (name "users") (gid 0)) + (groups (list (group-entry (name "users") (gid gid)) (group-entry (gid 65534) ;the overflow GID (name "overflow")))) (home-dir (password-entry-directory passwd)) @@ -541,6 +543,8 @@ (define* (launch-environment/container #:key command bash user user-mappings ;; A container's environment is already purified, so no need to ;; request it be purified again. (launch-environment command profile manifest #:pure? #f))) + #:guest-uid uid + #:guest-gid gid #:namespaces (if network? (delq 'net %namespaces) ; share host network %namespaces))))))) diff --git a/tests/guix-environment-container.sh b/tests/guix-environment-container.sh index f2221af95b..78507f76c0 100644 --- a/tests/guix-environment-container.sh +++ b/tests/guix-environment-container.sh @@ -44,6 +44,19 @@ else test $? = 42 fi +# By default, the UID inside the container should be the same as outside. +uid="`id -u`" +inner_uid="`guix environment -C --ad-hoc --bootstrap guile-bootstrap \ + -- guile -c '(display (getuid))'`" +test $inner_uid = $uid + +# When '--user' is passed, the UID should be 1000. (Note: Use a separate HOME +# so that we don't run into problems when the test directory is under /home.) +export tmpdir +inner_uid="`HOME=$tmpdir guix environment -C --ad-hoc --bootstrap guile-bootstrap \ + --user=gnu-guix -- guile -c '(display (getuid))'`" +test $inner_uid = 1000 + if test "x$USER" = "x"; then USER="`id -un`"; fi # Check whether /etc/passwd and /etc/group are valid. @@ -123,7 +136,7 @@ rm $tmpdir/mounts # Test that user can be mocked. usertest='(exit (and (string=? (getenv "HOME") "/home/foognu") - (string=? (passwd:name (getpwuid 0)) "foognu") + (string=? (passwd:name (getpwuid 1000)) "foognu") (file-exists? "/home/foognu/umock")))' touch "$tmpdir/umock" HOME="$tmpdir" guix environment --bootstrap --container --user=foognu \ -- cgit v1.2.3 From 305a732a0a19c5810aab401aa7d70eba02ac386b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 3 Apr 2019 13:55:06 +0200 Subject: services: xorg: Add 'set-xorg-configuration'. * gnu/services/xorg.scm (gdm-service-type)[compose, extend]: New fields. (set-xorg-configuration): New procedure. * doc/guix.texi (Keyboard Layout): Use it. (X Window): Document it. * gnu/system/examples/desktop.tmpl: Add 'keyboard-layout' fields. --- doc/guix.texi | 24 +++++++++++++++++------- gnu/services/xorg.scm | 22 +++++++++++++++++++++- gnu/system/examples/desktop.tmpl | 14 +++++++++++--- 3 files changed, 49 insertions(+), 11 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 616c2ef305..96755a6cce 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11077,6 +11077,7 @@ Let's say you want your system to use the Turkish keyboard layout throughout your system---bootloader, console, and Xorg. Here's what your system configuration would look like: +@findex set-xorg-configuration @lisp ;; Using the Turkish layout for the bootloader, the console, ;; and for Xorg. @@ -11088,18 +11089,17 @@ configuration would look like: (bootloader grub-efi-bootloader) (target "/boot/efi") (keyboard-layout keyboard-layout))) ;for GRUB - (services (modify-services %desktop-services - (gdm-service-type config => - (gdm-configuration - (inherit config) - (xorg-configuration + (services (cons (set-xorg-configuration (xorg-configuration ;for Xorg - (keyboard-layout keyboard-layout)))))))) + (keyboard-layout keyboard-layout))) + %desktop-services))) @end lisp In the example above, for GRUB and for Xorg, we just refer to the @code{keyboard-layout} field defined above, but we could just as well refer to -a different layout. +a different layout. The @code{set-xorg-configuration} procedure communicates +the desired Xorg configuration to the graphical log-in manager, by default +GDM. @node Locales @section Locales @@ -13566,6 +13566,16 @@ default is @code{-nolisten tcp}. @end table @end deftp +@deffn {Scheme Procedure} set-xorg-configuration @var{config} @ + [@var{login-manager-service-type}] +Tell the log-in manager (of type @var{login-manager-service-type}) to use +@var{config}, an record. + +Since the Xorg configuration is embedded in the log-in manager's +configuration---e.g., @code{gdm-configuration}---this procedure provides a +shorthand to set the Xorg configuration. +@end deffn + @deffn {Scheme Procedure} xorg-start-command [@var{config}] Return a @code{startx} script in which the modules, fonts, etc. specified in @var{config}, are available. The result should be used in place of diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 7745f9a3cc..26ca0d4f1f 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -99,7 +99,8 @@ (define-module (gnu services xorg) gdm-configuration gdm-service-type - gdm-service)) + gdm-service + set-xorg-configuration)) ;;; Commentary: ;;; @@ -875,6 +876,15 @@ (define gdm-service-type xorg-configuration-keyboard-layout gdm-configuration-xorg)))) + ;; For convenience, this service can be extended with an + ;; record. Take the first one that + ;; comes. + (compose first) + (extend (lambda (config xorg-configuration) + (gdm-configuration + (inherit config) + (xorg-configuration xorg-configuration)))) + (default-value (gdm-configuration)) (description "Run the GNOME Desktop Manager (GDM), a program that allows @@ -908,4 +918,14 @@ (define-deprecated (gdm-service #:key (gdm gdm) (gdm gdm) (allow-empty-passwords? allow-empty-passwords?)))) +(define* (set-xorg-configuration config + #:optional + (login-manager-service-type + gdm-service-type)) + "Tell the log-in manager (of type @var{login-manager-service-type}) to use +@var{config}, an record." + (simple-service 'set-xorg-configuration + login-manager-service-type + config)) + ;;; xorg.scm ends here diff --git a/gnu/system/examples/desktop.tmpl b/gnu/system/examples/desktop.tmpl index ff4c12b24a..baeb5e2d77 100644 --- a/gnu/system/examples/desktop.tmpl +++ b/gnu/system/examples/desktop.tmpl @@ -3,7 +3,7 @@ ;; root partition is encrypted with LUKS. (use-modules (gnu) (gnu system nss)) -(use-service-modules desktop) +(use-service-modules desktop xorg) (use-package-modules certs gnome) (operating-system @@ -11,11 +11,16 @@ (timezone "Europe/Paris") (locale "en_US.utf8") + ;; Choose US English keyboard layout. The "altgr-intl" + ;; variant provides dead keys for accented characters. + (keyboard-layout (keyboard-layout "us" "altgr-intl")) + ;; Use the UEFI variant of GRUB with the EFI System ;; Partition mounted on /boot/efi. (bootloader (bootloader-configuration (bootloader grub-efi-bootloader) - (target "/boot/efi"))) + (target "/boot/efi") + (keyboard-layout keyboard-layout))) ;; Specify a mapped device for the encrypted root partition. ;; The UUID is that returned by 'cryptsetup luksUUID'. @@ -58,7 +63,10 @@ ;; include the X11 log-in service, networking with ;; NetworkManager, and more. (services (append (list (service gnome-desktop-service-type) - (service xfce-desktop-service-type)) + (service xfce-desktop-service-type) + (set-xorg-configuration + (xorg-configuration + (keyboard-layout keyboard-layout)))) %desktop-services)) ;; Allow resolution of '.local' host names with mDNS. -- cgit v1.2.3 From a31af2beeeb5dceb9d535a598eb51e5792d44e14 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 3 Apr 2019 14:26:21 +0200 Subject: doc: Explain how to change the keyboard layout at run time. * doc/guix.texi (Keyboard Layout): Mention GNOME's "Region & Language", setxkbmap, and loadkeys. --- doc/guix.texi | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 96755a6cce..1b0bd1de58 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11002,6 +11002,8 @@ special-case and is automatically added whether or not it is specified. @node Keyboard Layout @section Keyboard Layout +@cindex keyboard layout +@cindex keymap To specify what each key of your keyboard does, you need to tell the operating system what @dfn{keyboard layout} you want to use. The default, when nothing is specified, is the US English QWERTY layout for 105-key PC keyboards. @@ -11101,6 +11103,34 @@ a different layout. The @code{set-xorg-configuration} procedure communicates the desired Xorg configuration to the graphical log-in manager, by default GDM. +We've discussed how to specify the @emph{default} keyboard layout of your +system when it starts, but you can also adjust it at run time: + +@itemize +@item +If you're using GNOME, its settings panel has a ``Region & Language'' entry +where you can select one or more keyboard layouts. + +@item +Under Xorg, the @command{setxkbmap} command (from the same-named package) +allows you to change the current layout. For example, this is how you would +change the layout to US Dvorak: + +@example +setxkbmap us dvorak +@end example + +@item +The @code{loadkeys} command changes the keyboard layout in effect in the Linux +console. However, note that @code{loadkeys} does @emph{not} use the XKB +keyboard layout categorization described above. The command below loads the +French bépo layout: + +@example +loadkeys fr-bepo +@end example +@end itemize + @node Locales @section Locales -- cgit v1.2.3 From 3a665637afc32a142dc24a77ce7ce9235eb6a3af Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 3 Apr 2019 14:32:41 +0200 Subject: services: console-keymap: Deprecate. * gnu/services/base.scm (console-keymap-service): Mark as deprecated. * doc/guix.texi (Base Services): Remove its documentation. --- doc/guix.texi | 23 ----------------------- gnu/services/base.scm | 3 ++- 2 files changed, 2 insertions(+), 24 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 1b0bd1de58..1c82579afc 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -12023,29 +12023,6 @@ This is the name of the file where some random bytes are saved by It defaults to @file{/var/lib/random-seed}. @end defvr -@cindex keymap -@cindex keyboard -@deffn {Scheme Procedure} console-keymap-service @var{files} ... -@cindex keyboard layout -Return a service to load console keymaps from @var{files} using -@command{loadkeys} command. Most likely, you want to load some default -keymap, which can be done like this: - -@example -(console-keymap-service "dvorak") -@end example - -Or, for example, for a Swedish keyboard, you may need to combine -the following keymaps: -@example -(console-keymap-service "se-lat6" "se-fi-lat6") -@end example - -Also you can specify a full file name (or file names) of your keymap(s). -See @code{man loadkeys} for details. - -@end deffn - @cindex mouse @cindex gpm @defvr {Scheme Variable} gpm-service-type diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 246932e5c8..65f7ff29c8 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -719,7 +719,8 @@ (define console-keymap-service-type #$@files)))) (respawn? #f))))) -(define (console-keymap-service . files) +(define-deprecated (console-keymap-service #:rest files) + #f "Return a service to load console keymaps from @var{files}." (service console-keymap-service-type files)) -- cgit v1.2.3 From 412e6396bbb8b398e8a94427db50271e47db610f Mon Sep 17 00:00:00 2001 From: 宋文武 Date: Sat, 6 Apr 2019 22:02:41 +0800 Subject: services: Add 'imap4d-service-type'. * gnu/services/mail.scm (): New record type. (imap4d-shepherd-service): New procedure. (%default-imap4d-config-file, imap4d-service-type): New variables. * gnu/services/mail.scm (Mail Services): Document it. --- doc/guix.texi | 30 ++++++++++++++++++++++++++++++ gnu/services/mail.scm | 45 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 74 insertions(+), 1 deletion(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 1c82579afc..cecad64e0c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -16559,6 +16559,36 @@ the @code{operating-system}'s @code{user-accounts} in order to deliver the @code{postmaster} mail to @code{bob} (which subsequently would deliver mail to @code{bob@@example.com} and @code{bob@@example2.com}). +@subsubheading GNU Mailutils IMAP4 Daemon +@cindex GNU Mailutils IMAP4 Daemon + +@deffn {Scheme Variable} imap4d-service-type +This is the type of the GNU Mailutils IMAP4 Daemon (@pxref{(mailutils) +imap4d}), whose value should be an @code{imap4d-configuration} object as in +this example: + +@example +(service imap4d-service-type + (imap4d-configuration + (config-file (local-file "imap4d.conf")))) +@end example +@end deffn + +@deftp {Data Type} imap4d-configuration +Data type representing the configuration of @command{imap4d}. + +@table @asis +@item @code{package} (default: @code{mailutils}) +The package that provides @command{imap4d}. + +@item @code{config-file} (default: @code{%default-imap4d-config-file}) +File-like object of the configuration file to use, by default it will listen +on the tcp port 143 of @code{localhost}. @xref{(mailutils) Conf-imap4d} for +details. + +@end table +@end deftp + @node Messaging Services @subsection Messaging Services diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm index a7e8c41d3a..0dabfed4cb 100644 --- a/gnu/services/mail.scm +++ b/gnu/services/mail.scm @@ -64,7 +64,12 @@ (define-module (gnu services mail) exim-configuration exim-configuration? exim-service-type - %default-exim-config-file)) + %default-exim-config-file + + imap4d-configuration + imap4d-configuration? + imap4d-service-type + %defualt-imap4d-config-file)) ;;; Commentary: ;;; @@ -1776,3 +1781,41 @@ (define exim-service-type (service-extension activation-service-type exim-activation) (service-extension profile-service-type exim-profile) (service-extension mail-aliases-service-type (const '())))))) + + +;;; +;;; GNU Mailutils IMAP4 Daemon. +;;; + +(define %default-imap4d-config-file + (plain-file "imap4d.conf" "server localhost {};\n")) + +(define-record-type* + imap4d-configuration make-imap4d-configuration imap4d-configuration? + (package imap4d-configuration-package + (default mailutils)) + (config-file imap4d-configuration-config-file + (default %default-imap4d-config-file))) + +(define imap4d-shepherd-service + (match-lambda + (($ package config-file) + (list (shepherd-service + (provision '(imap4d)) + (requirement '(networking syslogd)) + (documentation "Run the imap4d daemon.") + (start (let ((imap4d (file-append package "/sbin/imap4d"))) + #~(make-forkexec-constructor + (list #$imap4d "--daemon" "--foreground" + "--config-file" #$config-file)))) + (stop #~(make-kill-destructor))))))) + +(define imap4d-service-type + (service-type + (name 'imap4d) + (description + "Run the GNU @command{imap4d} to serve e-mail messages through IMAP.") + (extensions + (list (service-extension + shepherd-root-service-type imap4d-shepherd-service))) + (default-value (imap4d-configuration)))) -- cgit v1.2.3 From b596c5fbc18e42dad623b5c667b960df5b9dbc18 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 7 Apr 2019 11:39:40 +0200 Subject: doc: Fix syntax of cross-manual references. This is a followup to 412e6396bbb8b398e8a94427db50271e47db610f. * doc/guix.texi (Mail Services): Fix syntax of cross-references to the Mailutils manual. --- doc/guix.texi | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index cecad64e0c..2f9fcbe3bf 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -16563,9 +16563,9 @@ deliver mail to @code{bob@@example.com} and @code{bob@@example2.com}). @cindex GNU Mailutils IMAP4 Daemon @deffn {Scheme Variable} imap4d-service-type -This is the type of the GNU Mailutils IMAP4 Daemon (@pxref{(mailutils) -imap4d}), whose value should be an @code{imap4d-configuration} object as in -this example: +This is the type of the GNU Mailutils IMAP4 Daemon (@pxref{imap4d,,, +mailutils, GNU Mailutils Manual}), whose value should be an +@code{imap4d-configuration} object as in this example: @example (service imap4d-service-type @@ -16583,8 +16583,8 @@ The package that provides @command{imap4d}. @item @code{config-file} (default: @code{%default-imap4d-config-file}) File-like object of the configuration file to use, by default it will listen -on the tcp port 143 of @code{localhost}. @xref{(mailutils) Conf-imap4d} for -details. +on TCP port 143 of @code{localhost}. @xref{Conf-imap4d,,, mailutils, GNU +Mailutils Manual}, for details. @end table @end deftp -- cgit v1.2.3 From bacf980c76c94e7bda86220ca4bf662d0e34a45a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 6 Apr 2019 22:29:18 +0200 Subject: guix gc: Add '--list-roots'. * guix/scripts/gc.scm (show-help, %options): Add '--list-roots'. (guix-gc)[list-roots]: New procedure. Handle '--list-roots'. * tests/guix-gc.sh: Test it. * doc/guix.texi (Invoking guix gc): Document it. --- doc/guix.texi | 6 +++++- guix/scripts/gc.scm | 21 ++++++++++++++++++++- tests/guix-gc.sh | 6 ++++-- 3 files changed, 29 insertions(+), 4 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 2f9fcbe3bf..2345617b2e 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3385,7 +3385,7 @@ deleted. The set of garbage collector roots (``GC roots'' for short) includes default user profiles; by default, the symlinks under @file{/var/guix/gcroots} represent these GC roots. New GC roots can be added with @command{guix build --root}, for example (@pxref{Invoking -guix build}). +guix build}). The @command{guix gc --list-roots} command lists them. Prior to running @code{guix gc --collect-garbage} to make space, it is often useful to remove old generations from user profiles; that way, old @@ -3451,6 +3451,10 @@ This prints nothing unless the daemon was started with @option{--cache-failures} (@pxref{Invoking guix-daemon, @option{--cache-failures}}). +@item --list-roots +List the GC roots owned by the user; when run as root, list @emph{all} the GC +roots. + @item --clear-failures Remove the specified store items from the failed-build cache. diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm index 6f37b767ff..2606e20deb 100644 --- a/guix/scripts/gc.scm +++ b/guix/scripts/gc.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2012, 2013, 2015, 2016, 2017, 2018 Ludovic Courtès +;;; Copyright © 2012, 2013, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès ;;; ;;; This file is part of GNU Guix. ;;; @@ -20,6 +20,7 @@ (define-module (guix scripts gc) #:use-module (guix ui) #:use-module (guix scripts) #:use-module (guix store) + #:use-module (guix store roots) #:autoload (guix build syscalls) (free-disk-space) #:use-module (ice-9 match) #:use-module (ice-9 regex) @@ -48,6 +49,8 @@ (define (show-help) -F, --free-space=FREE attempt to reach FREE available space in the store")) (display (G_ " -d, --delete attempt to delete PATHS")) + (display (G_ " + --list-roots list the user's garbage collector roots")) (display (G_ " --optimize optimize the store by deduplicating identical files")) (display (G_ " @@ -135,6 +138,10 @@ (define %options (alist-cons 'verify-options options (alist-delete 'action result)))))) + (option '("list-roots") #f #f + (lambda (opt name arg result) + (alist-cons 'action 'list-roots + (alist-delete 'action result)))) (option '("list-dead") #f #f (lambda (opt name arg result) (alist-cons 'action 'list-dead @@ -205,6 +212,15 @@ (define (ensure-free-space store space) (info (G_ "freeing ~h MiBs~%") (/ to-free 1024. 1024.)) (collect-garbage store to-free))))) + (define (list-roots) + ;; List all the user-owned GC roots. + (let ((roots (filter (if (zero? (getuid)) (const #t) user-owned?) + (gc-roots)))) + (for-each (lambda (root) + (display root) + (newline)) + roots))) + (with-error-handling (let* ((opts (parse-options)) (store (open-connection)) @@ -238,6 +254,9 @@ (define (list-relatives relatives) (else (let-values (((paths freed) (collect-garbage store))) (info (G_ "freed ~h MiBs~%") (/ freed 1024. 1024.))))))) + ((list-roots) + (assert-no-extra-arguments) + (list-roots)) ((delete) (delete-paths store (map direct-store-path paths))) ((list-references) diff --git a/tests/guix-gc.sh b/tests/guix-gc.sh index ef2d9543b7..8284287730 100644 --- a/tests/guix-gc.sh +++ b/tests/guix-gc.sh @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2013, 2015, 2017, 2018 Ludovic Courtès +# Copyright © 2013, 2015, 2017, 2018, 2019 Ludovic Courtès # # This file is part of GNU Guix. # @@ -34,7 +34,7 @@ unset drv unset out # For some operations, passing extra arguments is an error. -for option in "" "-C 500M" "--verify" "--optimize" +for option in "" "-C 500M" "--verify" "--optimize" "--list-roots" do if guix gc $option whatever; then false; else true; fi done @@ -69,6 +69,8 @@ guix gc --delete "$drv" drv="`guix build --root=guix-gc-root lsh -d`" test -f "$drv" && test -L guix-gc-root +guix gc --list-roots | grep "$PWD/guix-gc-root" + guix gc --list-live | grep "$drv" if guix gc --delete "$drv"; then false; else true; fi -- cgit v1.2.3 From 96b8c2e6e2aa00b7b400530b62cf7479aa2d9674 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 6 Apr 2019 23:14:19 +0200 Subject: guix gc: Add '--delete-generations'. * guix/scripts/gc.scm (show-help, %options): Add '--delete-generations'. Change '--delete' shorthand to '-D'. (delete-old-generations): New procedure. (guix-gc)[delete-generations]: New procedure. Call it when ACTION is 'collect-garbage' and OPTS contains 'delete-generations. * doc/guix.texi (Invoking guix gc): Document it. --- doc/guix.texi | 16 +++++++++++++++- guix/scripts/gc.scm | 46 ++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 3 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 2345617b2e..406bea34d1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3438,8 +3438,22 @@ as @code{500MiB}, as described above. When @var{free} or more is already available in @file{/gnu/store}, do nothing and exit immediately. +@item --delete-generations[=@var{duration}] +@itemx -d [@var{duration}] +Before starting the garbage collection process, delete all the generations +older than @var{duration}, for all the user profiles; when run as root, this +applies to all the profiles @emph{of all the users}. + +For example, this command deletes all the generations of all your profiles +that are older than 2 months (except generations that are current), and then +proceeds to free space until at least 10 GiB are available: + +@example +guix gc -d 2m -F 10G +@end example + @item --delete -@itemx -d +@itemx -D Attempt to delete all the store files and directories specified as arguments. This fails if some of the files are not in the store, or if they are still live. diff --git a/guix/scripts/gc.scm b/guix/scripts/gc.scm index 2606e20deb..00f1eb8d00 100644 --- a/guix/scripts/gc.scm +++ b/guix/scripts/gc.scm @@ -22,6 +22,8 @@ (define-module (guix scripts gc) #:use-module (guix store) #:use-module (guix store roots) #:autoload (guix build syscalls) (free-disk-space) + #:autoload (guix profiles) (generation-profile) + #:autoload (guix scripts package) (delete-generations) #:use-module (ice-9 match) #:use-module (ice-9 regex) #:use-module (srfi srfi-1) @@ -48,7 +50,10 @@ (define (show-help) (display (G_ " -F, --free-space=FREE attempt to reach FREE available space in the store")) (display (G_ " - -d, --delete attempt to delete PATHS")) + -d, --delete-generations[=PATTERN] + delete profile generations matching PATTERN")) + (display (G_ " + -D, --delete attempt to delete PATHS")) (display (G_ " --list-roots list the user's garbage collector roots")) (display (G_ " @@ -98,6 +103,16 @@ (define argument->verify-options lst) '())))) +(define (delete-old-generations store profile pattern) + "Remove the generations of PROFILE that match PATTERN, a duration pattern. +Do nothing if none matches." + (let* ((current (generation-number profile)) + (numbers (matching-generations pattern profile + #:duration-relation >))) + + ;; Make sure we don't inadvertently remove the current generation. + (delete-generations store profile (delv current numbers)))) + (define %options ;; Specification of the command-line options. (list (option '(#\h "help") #f #f @@ -123,10 +138,25 @@ (define %options (option '(#\F "free-space") #t #f (lambda (opt name arg result) (alist-cons 'free-space (size->number arg) result))) - (option '(#\d "delete") #f #f + (option '(#\D "delete") #f #f ;used to be '-d' (lower case) (lambda (opt name arg result) (alist-cons 'action 'delete (alist-delete 'action result)))) + (option '(#\d "delete-generations") #f #t + (lambda (opt name arg result) + (if (and arg (store-path? arg)) + (begin + (warning (G_ "'-d' as an alias for '--delete' \ +is deprecated; use '-D'~%")) + `((action . delete) + (argument . ,arg) + (alist-delete 'action result))) + (begin + (when (and arg (not (string->duration arg))) + (leave (G_ "~s does not denote a duration~%") + arg)) + (alist-cons 'delete-generations (or arg "") + result))))) (option '("optimize") #f #f (lambda (opt name arg result) (alist-cons 'action 'optimize @@ -212,6 +242,14 @@ (define (ensure-free-space store space) (info (G_ "freeing ~h MiBs~%") (/ to-free 1024. 1024.)) (collect-garbage store to-free))))) + (define (delete-generations store pattern) + ;; Delete the generations matching PATTERN of all the user's profiles. + (let ((profiles (delete-duplicates + (filter-map generation-profile (gc-roots))))) + (for-each (lambda (profile) + (delete-old-generations store profile pattern)) + profiles))) + (define (list-roots) ;; List all the user-owned GC roots. (let ((roots (filter (if (zero? (getuid)) (const #t) user-owned?) @@ -245,6 +283,10 @@ (define (list-relatives relatives) (assert-no-extra-arguments) (let ((min-freed (assoc-ref opts 'min-freed)) (free-space (assoc-ref opts 'free-space))) + (match (assoc-ref opts 'delete-generations) + (#f #t) + ((? string? pattern) + (delete-generations store pattern))) (cond (free-space (ensure-free-space store free-space)) -- cgit v1.2.3 From 35934ff06ea447f335ece4e106dc9cf0aeed948b Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Tue, 9 Apr 2019 15:39:33 +0200 Subject: doc: Fix typo. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * doc/guix.texi (Bootloader Configuration): Fix ‘fow now’. --- doc/guix.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 406bea34d1..7dc4e1894a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -24001,7 +24001,7 @@ must @emph{not} be an OS device name such as @file{/dev/sda1}. @end deftp @c FIXME: Write documentation once it's stable. -Fow now only GRUB has theme support. GRUB themes are created using +For now only GRUB has theme support. GRUB themes are created using the @code{grub-theme} form, which is not documented yet. @defvr {Scheme Variable} %default-theme -- cgit v1.2.3 From ce6312999f20bb8d7e73c29b315747b1f4d184aa Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Fri, 5 Apr 2019 11:41:17 +0200 Subject: Add (guix build-system linux-module). * guix/build/linux-module-build-system.scm: New file. * guix/build-system/linux-module.scm: New file. * doc/guix.texi (Build Systems): Document it. * Makefile.am (MODULES): Add them. --- Makefile.am | 2 + doc/guix.texi | 27 +++++ guix/build-system/linux-module.scm | 166 +++++++++++++++++++++++++++++++ guix/build/linux-module-build-system.scm | 78 +++++++++++++++ 4 files changed, 273 insertions(+) create mode 100644 guix/build-system/linux-module.scm create mode 100644 guix/build/linux-module-build-system.scm (limited to 'doc/guix.texi') diff --git a/Makefile.am b/Makefile.am index 704f2451c3..8d523262cb 100644 --- a/Makefile.am +++ b/Makefile.am @@ -120,6 +120,7 @@ MODULES = \ guix/build-system/gnu.scm \ guix/build-system/guile.scm \ guix/build-system/haskell.scm \ + guix/build-system/linux-module.scm \ guix/build-system/perl.scm \ guix/build-system/python.scm \ guix/build-system/ocaml.scm \ @@ -173,6 +174,7 @@ MODULES = \ guix/build/texlive-build-system.scm \ guix/build/waf-build-system.scm \ guix/build/haskell-build-system.scm \ + guix/build/linux-module-build-system.scm \ guix/build/store-copy.scm \ guix/build/utils.scm \ guix/build/union.scm \ diff --git a/doc/guix.texi b/doc/guix.texi index 7dc4e1894a..9be7d9a27b 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -6210,6 +6210,33 @@ is not enabled by default. It can be enabled with @code{#:glib-or-gtk?}. @end table @end defvr +@defvr {Scheme Variable} linux-module-build-system +@var{linux-module-build-system} allows building Linux kernel modules. + +@cindex build phases +This build system is an extension of @var{gnu-build-system}, but with the +following phases changed: + +@table @code + +@item configure +This phase configures the environment so that the Linux kernel's Makefile +can be used to build the external kernel module. + +@item build +This phase uses the Linux kernel's Makefile in order to build the external +kernel module. + +@item install +This phase uses the Linux kernel's Makefile in order to install the external +kernel module. +@end table + +It is possible and useful to specify the Linux kernel to use for building +the module (in the "arguments" form of a package using the +linux-module-build-system, use the key #:linux to specify it). +@end defvr + Lastly, for packages that do not need anything as sophisticated, a ``trivial'' build system is provided. It is trivial in the sense that it provides basically no support: it does not pull any implicit inputs, diff --git a/guix/build-system/linux-module.scm b/guix/build-system/linux-module.scm new file mode 100644 index 0000000000..3ed3351353 --- /dev/null +++ b/guix/build-system/linux-module.scm @@ -0,0 +1,166 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Danny Milosavljevic +;;; +;;; 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 (guix build-system linux-module) + #:use-module (guix store) + #:use-module (guix utils) + #:use-module (guix derivations) + #:use-module (guix search-paths) + #:use-module (guix build-system) + #:use-module (guix build-system gnu) + #:use-module (guix packages) + #:use-module (ice-9 match) + #:export (%linux-module-build-system-modules + linux-module-build + linux-module-build-system)) + +;; Commentary: +;; +;; Code: + +(define %linux-module-build-system-modules + ;; Build-side modules imported by default. + `((guix build linux-module-build-system) + ,@%gnu-build-system-modules)) + +(define (default-linux) + "Return the default Linux package." + + ;; Do not use `@' to avoid introducing circular dependencies. + (let ((module (resolve-interface '(gnu packages linux)))) + (module-ref module 'linux-libre))) + +(define (default-kmod) + "Return the default kmod package." + + ;; Do not use `@' to avoid introducing circular dependencies. + (let ((module (resolve-interface '(gnu packages linux)))) + (module-ref module 'kmod))) + +(define (default-gcc) + "Return the default gcc package." + + ;; Do not use `@' to avoid introducing circular dependencies. + (let ((module (resolve-interface '(gnu packages gcc)))) + (module-ref module 'gcc-7))) + +(define (make-linux-module-builder linux) + (package + (inherit linux) + (name (string-append (package-name linux) "-module-builder")) + (arguments + (substitute-keyword-arguments (package-arguments linux) + ((#:phases phases) + `(modify-phases ,phases + (replace 'build + (lambda _ + (invoke "make" "modules_prepare"))) + (delete 'strip) ; faster. + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (out-lib-build (string-append out "/lib/modules/build"))) + ; TODO: Only preserve the minimum, i.e. [Kbuild], Kconfig, scripts, include, ".config". + (copy-recursively "." out-lib-build) + #t))))))))) + +(define* (lower name + #:key source inputs native-inputs outputs + system target + (linux (default-linux)) + #:allow-other-keys + #:rest arguments) + "Return a bag for NAME." + (define private-keywords + '(#:source #:target #:gcc #:kmod #:linux #:inputs #:native-inputs)) + + (and (not target) ;XXX: no cross-compilation + (bag + (name name) + (system system) + (host-inputs `(,@(if source + `(("source" ,source)) + '()) + ,@inputs + ,@(standard-packages))) + (build-inputs `(("linux" ,linux) ; for "Module.symvers". + ("linux-module-builder" + ,(make-linux-module-builder linux)) + ,@native-inputs + ;; TODO: Remove "gmp", "mpfr", "mpc" since they are only needed to compile the gcc plugins. Maybe remove "flex", "bison", "elfutils", "perl", "openssl". That leaves very little ("bc", "gcc", "kmod"). + ,@(package-native-inputs linux))) + (outputs outputs) + (build linux-module-build) + (arguments (strip-keyword-arguments private-keywords arguments))))) + +(define* (linux-module-build store name inputs + #:key + (search-paths '()) + (tests? #t) + (phases '(@ (guix build linux-module-build-system) + %standard-phases)) + (outputs '("out")) + (system (%current-system)) + (guile #f) + (imported-modules + %linux-module-build-system-modules) + (modules '((guix build linux-module-build-system) + (guix build utils)))) + "Build SOURCE using LINUX, and with INPUTS." + (define builder + `(begin + (use-modules ,@modules) + (linux-module-build #:name ,name + #:source ,(match (assoc-ref inputs "source") + (((? derivation? source)) + (derivation->output-path source)) + ((source) + source) + (source + source)) + #:search-paths ',(map search-path-specification->sexp + search-paths) + #:phases ,phases + #:system ,system + #:tests? ,tests? + #:outputs %outputs + #:inputs %build-inputs))) + + (define guile-for-build + (match guile + ((? package?) + (package-derivation store guile system #:graft? #f)) + (#f ; the default + (let* ((distro (resolve-interface '(gnu packages commencement))) + (guile (module-ref distro 'guile-final))) + (package-derivation store guile system #:graft? #f))))) + + (build-expression->derivation store name builder + #:system system + #:inputs inputs + #:modules imported-modules + #:outputs outputs + #:guile-for-build guile-for-build)) + +(define linux-module-build-system + (build-system + (name 'linux-module) + (description "The Linux module build system") + (lower lower))) + +;;; linux-module.scm ends here diff --git a/guix/build/linux-module-build-system.scm b/guix/build/linux-module-build-system.scm new file mode 100644 index 0000000000..a6664f1eca --- /dev/null +++ b/guix/build/linux-module-build-system.scm @@ -0,0 +1,78 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Danny Milosavljevic +;;; +;;; 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 (guix build linux-module-build-system) + #:use-module ((guix build gnu-build-system) #:prefix gnu:) + #:use-module (guix build utils) + #:use-module (ice-9 ftw) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + #:export (%standard-phases + linux-module-build)) + +;; Commentary: +;; +;; Builder-side code of linux-module build. +;; +;; Code: + +;; TODO: It might make sense to provide "Module.symvers" in the future. +(define* (configure #:key inputs #:allow-other-keys) + #t) + +(define* (build #:key inputs make-flags #:allow-other-keys) + (apply invoke "make" "-C" + (string-append (assoc-ref inputs "linux-module-builder") + "/lib/modules/build") + (string-append "M=" (getcwd)) + (or make-flags '()))) + +;; This block was copied from make-linux-libre--only took the "modules_install" +;; part. +(define* (install #:key inputs native-inputs outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (moddir (string-append out "/lib/modules")) + (kmod (assoc-ref (or native-inputs inputs) "kmod"))) + ;; Install kernel modules + (mkdir-p moddir) + (invoke "make" "-C" + (string-append (assoc-ref inputs "linux-module-builder") + "/lib/modules/build") + (string-append "M=" (getcwd)) + (string-append "DEPMOD=" kmod "/bin/depmod") + (string-append "MODULE_DIR=" moddir) + (string-append "INSTALL_PATH=" out) + (string-append "INSTALL_MOD_PATH=" out) + "INSTALL_MOD_STRIP=1" + "modules_install"))) + +(define %standard-phases + (modify-phases gnu:%standard-phases + (replace 'configure configure) + (replace 'build build) + (replace 'install install))) + +(define* (linux-module-build #:key inputs (phases %standard-phases) + #:allow-other-keys #:rest args) + "Build the given package, applying all of PHASES in order, with a Linux kernel in attendance." + (apply gnu:gnu-build + #:inputs inputs #:phases phases + args)) + +;;; linux-module-build-system.scm ends here -- cgit v1.2.3 From 96ef8565281c511b119e0dd7799337d67f9efab3 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 12 Apr 2019 14:11:00 +0200 Subject: doc: Strip the "Limitations" section. * doc/guix.texi (Limitations): Strip the paragraph about not being production-ready. Remove the number of packages. --- doc/guix.texi | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 9be7d9a27b..52972cf812 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -1795,25 +1795,14 @@ available. @node Limitations @section Limitations -As of version @value{VERSION}, Guix System is -not production-ready. It may contain bugs and lack important -features. Thus, if you are looking for a stable production system that -respects your freedom as a computer user, a good solution at this point -is to consider @url{http://www.gnu.org/distros/free-distros.html, one of -the more established GNU/Linux distributions}. We hope you can soon switch -to the Guix System without fear, of course. In the meantime, you can -also keep using your distribution and try out the package manager on top -of it (@pxref{Installation}). - -Before you proceed with the installation, be aware of the following -noteworthy limitations applicable to version @value{VERSION}: +We consider Guix System to be ready for a wide range of ``dekstop'' and server +use cases. The reliability guarantees it provides---transactional upgrades +and rollbacks, reproducibility---make it a solid foundation. -@itemize -@item -The installation process does not include a graphical user interface and -requires familiarity with GNU/Linux (see the following subsections to -get a feel of what that means.) +Nevertheless, before you proceed with the installation, be aware of the +following noteworthy limitations applicable to version @value{VERSION}: +@itemize @item Support for the Logical Volume Manager (LVM) is missing. @@ -1821,19 +1810,15 @@ Support for the Logical Volume Manager (LVM) is missing. More and more system services are provided (@pxref{Services}), but some may be missing. -@item -More than 8,500 packages are available, but you might -occasionally find that a useful package is missing. - @item GNOME, Xfce, LXDE, and Enlightenment are available (@pxref{Desktop Services}), -as well as a number of X11 window managers. However, some graphical -applications may be missing, as well as KDE. +as well as a number of X11 window managers. However, KDE is currently +missing. @end itemize -You have been warned! But more than a disclaimer, this is an invitation -to report issues (and success stories!), and to join us in improving it. -@xref{Contributing}, for more info. +More than a disclaimer, this is an invitation to report issues (and success +stories!), and to join us in improving it. @xref{Contributing}, for more +info. @node Hardware Considerations -- cgit v1.2.3 From a0b419bc643ad5c2fd4a6c58e0b39938f2156a84 Mon Sep 17 00:00:00 2001 From: Danny Milosavljevic Date: Sun, 14 Apr 2019 20:05:45 +0200 Subject: doc: Fix typo. Follow-up to 96ef8565281c511b119e0dd7799337d67f9efab3. * doc/guix.texi (Limitations): Fix typo. --- doc/guix.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 52972cf812..ea72c731df 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -1795,7 +1795,7 @@ available. @node Limitations @section Limitations -We consider Guix System to be ready for a wide range of ``dekstop'' and server +We consider Guix System to be ready for a wide range of ``desktop'' and server use cases. The reliability guarantees it provides---transactional upgrades and rollbacks, reproducibility---make it a solid foundation. -- cgit v1.2.3 From d5752f68ef38ce779723cf5864574374b8417ff3 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Thu, 11 Apr 2019 02:56:59 +0200 Subject: doc: Fix location of fprintd-service-type. * doc/guix.texi (Miscellaneous Services): Correct module name. --- doc/guix.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index ea72c731df..5fefc1af4f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -23152,7 +23152,7 @@ The port to bind the server to. @cindex fingerprint @subsubheading Fingerprint Service -The @code{(gnu services fingerprint)} module provides a DBus service to +The @code{(gnu services authentication)} module provides a DBus service to read and identify fingerprints via a fingerprint sensor. @defvr {Scheme Variable} fprintd-service-type -- cgit v1.2.3 From 3f03a198b2f1ad7ff6f1d53c287c36011024d67c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 15 Apr 2019 11:30:50 +0200 Subject: system: Add 'label' field to . * gnu/system.scm ()[label]: New field. (operating-system-default-label): New procedure. (operating-system-boot-parameters): Use it instead of 'kernel->boot-label'. * doc/guix.texi (operating-system Reference): Document it. --- doc/guix.texi | 4 ++++ gnu/system.scm | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 5fefc1af4f..1ae5711c02 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -10436,6 +10436,10 @@ the command-line of the kernel---e.g., @code{("console=ttyS0")}. @item @code{bootloader} The system bootloader configuration object. @xref{Bootloader Configuration}. +@item @code{label} +This is the label (a string) as it appears in the bootloader's menu entry. +The default label includes the kernel name and version. + @item @code{keyboard-layout} (default: @code{#f}) This field specifies the keyboard layout to use in the console. It can be either @code{#f}, in which case the default keyboard layout is used (usually diff --git a/gnu/system.scm b/gnu/system.scm index 2abb1fefff..24243eb707 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -78,6 +78,8 @@ (define-module (gnu system) operating-system-kernel operating-system-kernel-file operating-system-kernel-arguments + operating-system-label + operating-system-default-label operating-system-initrd-modules operating-system-initrd operating-system-users @@ -160,6 +162,9 @@ (define-record-type* operating-system (kernel-arguments operating-system-user-kernel-arguments (default '())) ; list of gexps/strings (bootloader operating-system-bootloader) ; + (label operating-system-label ; string + (thunked) + (default (operating-system-default-label this-operating-system))) (keyboard-layout operating-system-keyboard-layout ;#f | (default #f)) @@ -918,6 +923,11 @@ (define (kernel->boot-label kernel) (inferior-package-version kernel))) (else "GNU"))) +(define (operating-system-default-label os) + "Return the default label for OS, as it will appear in the bootloader menu +entry." + (kernel->boot-label (operating-system-kernel os))) + (define (store-file-system file-systems) "Return the file system object among FILE-SYSTEMS that contains the store." (match (filter (lambda (fs) @@ -966,7 +976,7 @@ (define* (operating-system-boot-parameters os root-device (bootloader (bootloader-configuration-bootloader (operating-system-bootloader os))) (bootloader-name (bootloader-name bootloader)) - (label (kernel->boot-label (operating-system-kernel os)))) + (label (operating-system-label os))) (boot-parameters (label label) (root-device root-device) -- cgit v1.2.3 From cbd059d1017bc22723f1e5293cc8f20dea640fff Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 15 Apr 2019 12:23:30 +0200 Subject: doc: Document 'this-package' and 'this-operating-system'. * doc/guix.texi (package Reference): Document 'this-package'. (operating-system Reference): Document 'this-operating-system'. --- doc/guix.texi | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 1ae5711c02..4593d793b4 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -5409,6 +5409,27 @@ automatically corrected. @end table @end deftp +@deffn {Scheme Syntax} this-package +When used in the @emph{lexical scope} of a package field definition, this +identifier resolves to the package being defined. + +The example below shows how to add a package as a native input of itself when +cross-compiling: + +@example +(package + (name "guile") + ;; ... + + ;; When cross-compiled, Guile, for example, depends on + ;; a native version of itself. Add it here. + (native-inputs (if (%current-target-system) + `(("self" ,this-package)) + '()))) +@end example + +It is an error to refer to @code{this-package} outside a package definition. +@end deffn @node origin Reference @subsection @code{origin} Reference @@ -10592,6 +10613,27 @@ is that only @code{root} and members of the @code{wheel} group may use @code{sudo}. @end table + +@deffn {Scheme Syntax} this-operating-system +When used in the @emph{lexical scope} of an operating system field definition, +this identifier resolves to the operating system being defined. + +The example below shows how to refer to the operating system being defined in +the definition of the @code{label} field: + +@example +(use-modules (gnu) (guix)) + +(operating-system + ;; ... + (label (package-full-name + (operating-system-kernel this-operating-system)))) +@end example + +It is an error to refer to @code{this-operating-system} outside an operating +system definition. +@end deffn + @end deftp @node File Systems -- cgit v1.2.3 From 16cdba76e46324869cfe1372a477db6a9362b42b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 15 Apr 2019 17:03:33 +0200 Subject: doc: Replace misuses of @var by @code. * doc/guix.texi (Hardware Considerations, Service Types and Services) (Service Reference, Shepherd Services, Security Updates): Use @code instead of @var for things that are not meta-syntactic variables. --- doc/guix.texi | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 4593d793b4..f8e7436cf1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -1841,7 +1841,7 @@ devices. WiFi devices known to work include those using Atheros chips driver, and those using Broadcom/AirForce chips (BCM43xx with Wireless-Core Revision 5), which corresponds to the @code{b43-open} Linux-libre driver. Free firmware exists for both and is available -out-of-the-box on Guix System, as part of @var{%base-firmware} +out-of-the-box on Guix System, as part of @code{%base-firmware} (@pxref{operating-system Reference, @code{firmware}}). @cindex RYF, Respects Your Freedom @@ -24745,23 +24745,23 @@ exception is the @dfn{boot service type}, which is the ultimate service. Optionally, a default value for instances of this type. @end enumerate -In this example, @var{guix-service-type} extends three services: +In this example, @code{guix-service-type} extends three services: -@table @var +@table @code @item shepherd-root-service-type -The @var{guix-shepherd-service} procedure defines how the Shepherd +The @code{guix-shepherd-service} procedure defines how the Shepherd service is extended. Namely, it returns a @code{} object that defines how @command{guix-daemon} is started and stopped (@pxref{Shepherd Services}). @item account-service-type -This extension for this service is computed by @var{guix-accounts}, +This extension for this service is computed by @code{guix-accounts}, which returns a list of @code{user-group} and @code{user-account} objects representing the build user accounts (@pxref{Invoking guix-daemon}). @item activation-service-type -Here @var{guix-activation} is a procedure that returns a gexp, which is +Here @code{guix-activation} is a procedure that returns a gexp, which is a code snippet to run at ``activation time''---e.g., when the service is booted. @end table @@ -24786,7 +24786,7 @@ value is omitted, the default value specified by (service guix-service-type) @end example -@var{guix-service-type} is quite simple because it extends other +@code{guix-service-type} is quite simple because it extends other services but is not extensible itself. @c @subsubsubsection Extensible Service Types @@ -24812,7 +24812,7 @@ The service type for an @emph{extensible} service looks like this: This is the service type for the @uref{https://wiki.gentoo.org/wiki/Project:Eudev, eudev device management daemon}. Compared to the previous example, in addition to an -extension of @var{shepherd-root-service-type}, we see two new fields: +extension of @code{shepherd-root-service-type}, we see two new fields: @table @code @item compose @@ -24839,7 +24839,7 @@ them (@pxref{Invoking guix system}). @end table There can be only one instance of an extensible service type such as -@var{udev-service-type}. If there were more, the +@code{udev-service-type}. If there were more, the @code{service-extension} specifications would be ambiguous. Still here? The next section provides a reference of the programming @@ -24913,7 +24913,7 @@ Here is an example of how a service is created and manipulated: The @code{modify-services} form provides a handy way to change the parameters of some of the services of a list such as -@var{%base-services} (@pxref{Base Services, @code{%base-services}}). It +@code{%base-services} (@pxref{Base Services, @code{%base-services}}). It evaluates to a list of services. Of course, you could always use standard list combinators such as @code{map} and @code{fold} to do that (@pxref{SRFI-1, List Library,, guile, GNU Guile Reference Manual}); @@ -25094,8 +25094,8 @@ You can actually generate such a graph for any operating system definition using the @command{guix system shepherd-graph} command (@pxref{system-shepherd-graph, @command{guix system shepherd-graph}}). -The @var{%shepherd-root-service} is a service object representing -PID@tie{}1, of type @var{shepherd-root-service-type}; it can be extended +The @code{%shepherd-root-service} is a service object representing +PID@tie{}1, of type @code{shepherd-root-service-type}; it can be extended by passing it lists of @code{} objects. @deftp {Data Type} shepherd-service @@ -25143,10 +25143,10 @@ A documentation string, as shown when running: herd doc @var{service-name} @end example -where @var{service-name} is one of the symbols in @var{provision} +where @var{service-name} is one of the symbols in @code{provision} (@pxref{Invoking herd,,, shepherd, The GNU Shepherd Manual}). -@item @code{modules} (default: @var{%default-modules}) +@item @code{modules} (default: @code{%default-modules}) This is the list of modules that must be in scope when @code{start} and @code{stop} are evaluated. @@ -25393,7 +25393,7 @@ order of magnitudes lower than a full rebuild of the dependency chain. @cindex replacements of packages, for grafts For instance, suppose a security update needs to be applied to Bash. Guix developers will provide a package definition for the ``fixed'' -Bash, say @var{bash-fixed}, in the usual way (@pxref{Defining +Bash, say @code{bash-fixed}, in the usual way (@pxref{Defining Packages}). Then, the original package definition is augmented with a @code{replacement} field pointing to the package containing the bug fix: @@ -25408,14 +25408,14 @@ Packages}). Then, the original package definition is augmented with a From there on, any package depending directly or indirectly on Bash---as reported by @command{guix gc --requisites} (@pxref{Invoking guix gc})---that is installed is automatically ``rewritten'' to refer to -@var{bash-fixed} instead of @var{bash}. This grafting process takes +@code{bash-fixed} instead of @code{bash}. This grafting process takes time proportional to the size of the package, usually less than a minute for an ``average'' package on a recent machine. Grafting is recursive: when an indirect dependency requires grafting, then grafting ``propagates'' up to the package that the user is installing. Currently, the length of the name and version of the graft and that of -the package it replaces (@var{bash-fixed} and @var{bash} in the example +the package it replaces (@code{bash-fixed} and @code{bash} in the example above) must be equal. This restriction mostly comes from the fact that grafting works by patching files, including binary files, directly. Other restrictions may apply: for instance, when adding a graft to a -- cgit v1.2.3 From 72f749dcb83dbda9f98e28fa3622cc1d3db6275a Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 17 Apr 2019 13:56:40 +0200 Subject: pull: '--url', '--commit', and '--branch' apply to the 'guix' channel. Suggested by pkill9 . * guix/scripts/pull.scm (channel-list): Apply REF and URL to the 'guix' channel. * doc/guix.texi (Invoking guix pull): Adjust accordingly. --- doc/guix.texi | 5 +++-- guix/channels.scm | 1 + guix/scripts/pull.scm | 24 +++++++++++------------- 3 files changed, 15 insertions(+), 15 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index f8e7436cf1..6b713aaf9c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3646,8 +3646,9 @@ but it supports the following options: @item --url=@var{url} @itemx --commit=@var{commit} @itemx --branch=@var{branch} -Download code from the specified @var{url}, at the given @var{commit} (a valid -Git commit ID represented as a hexadecimal string), or @var{branch}. +Download code for the @code{guix} channel from the specified @var{url}, at the +given @var{commit} (a valid Git commit ID represented as a hexadecimal +string), or @var{branch}. @cindex @file{channels.scm}, configuration file @cindex configuration file for channels diff --git a/guix/channels.scm b/guix/channels.scm index 9658cf9393..e93879e1b4 100644 --- a/guix/channels.scm +++ b/guix/channels.scm @@ -52,6 +52,7 @@ (define-module (guix channels) channel-location %default-channels + guix-channel? channel-instance? channel-instance-channel diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 55137fce8f..71e13686c0 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -502,24 +502,22 @@ (define (environment-variable) (url (or (assoc-ref opts 'repository-url) (environment-variable)))) (if (or ref url) - (match channels - ((one) - ;; When there's only one channel, apply '--url', '--commit', and - ;; '--branch' to this specific channel. - (let ((url (or url (channel-url one)))) - (list (match ref + (match (find guix-channel? channels) + ((? channel? guix) + ;; Apply '--url', '--commit', and '--branch' to the 'guix' channel. + (let ((url (or url (channel-url guix)))) + (cons (match ref (('commit . commit) - (channel (inherit one) + (channel (inherit guix) (url url) (commit commit) (branch #f))) (('branch . branch) - (channel (inherit one) + (channel (inherit guix) (url url) (commit #f) (branch branch))) (#f - (channel (inherit one) (url url))))))) - (_ - ;; Otherwise bail out. - (leave - (G_ "'--url', '--commit', and '--branch' are not applicable~%")))) + (channel (inherit guix) (url url)))) + (remove guix-channel? channels)))) + (#f ;no 'guix' channel, failure will ensue + channels)) channels))) -- cgit v1.2.3 From ea261dea0c581771b4cf297e983f7addc6807051 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 19 Apr 2019 15:18:20 +0200 Subject: guix build: Accept multiple '-s' options. * guix/scripts/build.scm (%default-options): Remove 'system'. (%options) <--system>: Keep previous occurrences of 'system in RESULT. (options->derivations)[system]: Remove. [systems, things-to-build]: New variables. [compute-derivation]: New procedure. Iterate on all of SYSTEMS to compute the derivations of THINGS-TO-BUILD. * tests/guix-build.sh: Add test for one and multiple '-s' flags. * doc/guix.texi (Additional Build Options): Document this behavior. --- doc/guix.texi | 4 +- guix/scripts/build.scm | 107 +++++++++++++++++++++++++++---------------------- tests/guix-build.sh | 7 ++++ 3 files changed, 70 insertions(+), 48 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 6b713aaf9c..8c7522f286 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -8030,7 +8030,9 @@ The following derivations will be built: @item --system=@var{system} @itemx -s @var{system} Attempt to build for @var{system}---e.g., @code{i686-linux}---instead of -the system type of the build host. +the system type of the build host. The @command{guix build} command allows +you to repeat this option several times, in which case it builds for all the +specified systems; other commands ignore extraneous @option{-s} options. @quotation Note The @code{--system} flag is for @emph{native} compilation and must not diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index fc0c0e2ad3..ba143ad16b 100644 --- a/guix/scripts/build.scm +++ b/guix/scripts/build.scm @@ -635,8 +635,7 @@ (define %standard-build-options (define %default-options ;; Alist of default option values. - `((system . ,(%current-system)) - (build-mode . ,(build-mode normal)) + `((build-mode . ,(build-mode normal)) (graft? . #t) (substitutes? . #t) (build-hook? . #t) @@ -729,8 +728,7 @@ (define %options rest))) (option '(#\s "system") #t #f (lambda (opt name arg result) - (alist-cons 'system arg - (alist-delete 'system result eq?)))) + (alist-cons 'system arg result))) (option '("target") #t #f (lambda (opt name arg result) (alist-cons 'target arg @@ -811,56 +809,71 @@ (define package->derivation (cut package-cross-derivation <> <> triplet <>)))) (define src (assoc-ref opts 'source)) - (define system (assoc-ref opts 'system)) (define graft? (assoc-ref opts 'graft?)) + (define systems + (match (filter-map (match-lambda + (('system . system) system) + (_ #f)) + opts) + (() (list (%current-system))) + (systems systems))) + + (define things-to-build + (map (cut transform store <>) + (options->things-to-build opts))) + + (define (compute-derivation obj system) + ;; Compute the derivation of OBJ for SYSTEM. + (match obj + ((? package? p) + (let ((p (or (and graft? (package-replacement p)) p))) + (match src + (#f + (list (package->derivation store p system))) + (#t + (match (package-source p) + (#f + (format (current-error-port) + (G_ "~a: warning: \ +package '~a' has no source~%") + (location->string (package-location p)) + (package-name p)) + '()) + (s + (list (package-source-derivation store s))))) + (proc + (map (cut package-source-derivation store <>) + (proc p)))))) + ((? derivation? drv) + (list drv)) + ((? procedure? proc) + (list (run-with-store store + (mbegin %store-monad + (set-guile-for-build (default-guile)) + (proc)) + #:system system))) + ((? file-like? obj) + (list (run-with-store store + (lower-object obj system + #:target (assoc-ref opts 'target)) + #:system system))) + ((? gexp? gexp) + (list (run-with-store store + (mbegin %store-monad + (set-guile-for-build (default-guile)) + (gexp->derivation "gexp" gexp + #:system system)) + #:system system))))) ;; We may get 'unbound-variable' errors while evaluating the 'inputs' fields ;; of user packages. Since 'guix build' is the primary tool for people ;; testing new packages, report such errors gracefully. (with-unbound-variable-handling (parameterize ((%graft? graft?)) - (append-map (match-lambda - ((? package? p) - (let ((p (or (and graft? (package-replacement p)) p))) - (match src - (#f - (list (package->derivation store p system))) - (#t - (match (package-source p) - (#f - (format (current-error-port) - (G_ "~a: warning: \ -package '~a' has no source~%") - (location->string (package-location p)) - (package-name p)) - '()) - (s - (list (package-source-derivation store s))))) - (proc - (map (cut package-source-derivation store <>) - (proc p)))))) - ((? derivation? drv) - (list drv)) - ((? procedure? proc) - (list (run-with-store store - (mbegin %store-monad - (set-guile-for-build (default-guile)) - (proc)) - #:system system))) - ((? file-like? obj) - (list (run-with-store store - (lower-object obj system - #:target (assoc-ref opts 'target)) - #:system system))) - ((? gexp? gexp) - (list (run-with-store store - (mbegin %store-monad - (set-guile-for-build (default-guile)) - (gexp->derivation "gexp" gexp - #:system system)) - #:system system)))) - (map (cut transform store <>) - (options->things-to-build opts)))))) + (append-map (lambda (system) + (append-map (cut compute-derivation <> system) + things-to-build)) + systems)))) (define (show-build-log store file urls) "Show the build log for FILE, falling back to remote logs from URLS if diff --git a/tests/guix-build.sh b/tests/guix-build.sh index d479296ef1..63a9fe68da 100644 --- a/tests/guix-build.sh +++ b/tests/guix-build.sh @@ -44,6 +44,13 @@ guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)' guix build -e '(@@ (gnu packages bootstrap) %bootstrap-guile)'; \ then exit 1; fi ) +# Passing one '-s' flag. +test `guix build sed -s x86_64-linux -d | wc -l` = 1 + +# Passing multiple '-s' flags. +all_systems="-s x86_64-linux -s i686-linux -s armhf-linux -s aarch64-linux" +test `guix build sed $all_systems -d | sort -u | wc -l` = 4 + # Check --sources option with its arguments module_dir="t-guix-build-$$" mkdir "$module_dir" -- cgit v1.2.3 From c5265a095172b213ba6fbdf618d6779359ca56b2 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 21 Apr 2019 21:26:06 +0200 Subject: pull: Add '--news'. Suggested by Tobias Geerinckx-Rice . * guix/scripts/pull.scm (%options, show-help): Add '--news'. (display-profile-news): Add #:current-is-newer? and #:concise?. Honor them. (build-and-install): Pass #:concise? #t. (display-new/upgraded-packages)[concise/max-item-count]: New variable. Add call to 'display-hint'. (process-query): Add clause for 'display-news'. * doc/guix.texi (Invoking guix pull): Add '--news'. --- doc/guix.texi | 8 ++++++ guix/scripts/pull.scm | 76 ++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 62 insertions(+), 22 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 8c7522f286..785329add8 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3663,6 +3663,14 @@ Read the list of channels from @var{file} instead of evaluates to a list of channel objects. @xref{Channels}, for more information. +@item --news +@itemx -N +Display the list of packages added or upgraded since the previous generation. + +This is the same information as displayed upon @command{guix pull} completion, +but without ellipses; it is also similar to the output of @command{guix pull +-l} for the last generation (see below). + @item --list-generations[=@var{pattern}] @itemx -l [@var{pattern}] List all the generations of @file{~/.config/guix/current} or, if @var{pattern} diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm index 71e13686c0..04e83f970f 100644 --- a/guix/scripts/pull.scm +++ b/guix/scripts/pull.scm @@ -86,6 +86,8 @@ (define (show-help) (display (G_ " --branch=BRANCH download the tip of the specified BRANCH")) (display (G_ " + -N, --news display news compared to the previous generation")) + (display (G_ " -l, --list-generations[=PATTERN] list generations matching PATTERN")) (display (G_ " @@ -117,6 +119,9 @@ (define %options (lambda (opt name arg result) (cons `(query list-generations ,(or arg "")) result))) + (option '(#\N "news") #f #f + (lambda (opt name arg result) + (cons '(query display-news) result))) (option '("url") #t #f (lambda (opt name arg result) (alist-cons 'repository-url arg @@ -162,25 +167,33 @@ (define what-to-build (define indirect-root-added (store-lift add-indirect-root)) -(define (display-profile-news profile) - "Display what's up in PROFILE--new packages, and all that." +(define* (display-profile-news profile #:key concise? + current-is-newer?) + "Display what's up in PROFILE--new packages, and all that. If +CURRENT-IS-NEWER? is true, assume that the current process represents the +newest generation of PROFILE.x" (match (memv (generation-number profile) (reverse (profile-generations profile))) ((current previous _ ...) - (newline) - (let ((old (fold-available-packages - (lambda* (name version result - #:key supported? deprecated? - #:allow-other-keys) - (if (and supported? (not deprecated?)) - (alist-cons name version result) - result)) - '())) - (new (profile-package-alist - (generation-file-name profile current)))) - (display-new/upgraded-packages old new - #:concise? #t - #:heading (G_ "New in this revision:\n")))) + (let ((these (fold-available-packages + (lambda* (name version result + #:key supported? deprecated? + #:allow-other-keys) + (if (and supported? (not deprecated?)) + (alist-cons name version result) + result)) + '())) + (those (profile-package-alist + (generation-file-name profile + (if current-is-newer? + previous + current))))) + (let ((old (if current-is-newer? those these)) + (new (if current-is-newer? these those))) + (display-new/upgraded-packages old new + #:concise? concise? + #:heading + (G_ "New in this revision:\n"))))) (_ #t))) (define* (build-and-install instances profile @@ -196,7 +209,8 @@ (define update-profile #:hooks %channel-profile-hooks #:dry-run? dry-run?) (munless dry-run? - (return (display-profile-news profile)) + (return (newline)) + (return (display-profile-news profile #:concise? #t)) (match (which "guix") (#f (return #f)) (str @@ -394,9 +408,13 @@ (define (pretty str column) column) 4)) + (define concise/max-item-count + ;; Maximum number of items to display when CONCISE? is true. + 12) + (define list->enumeration (if concise? - (lambda* (lst #:optional (max 12)) + (lambda* (lst #:optional (max concise/max-item-count)) (if (> (length lst) max) (string-append (string-join (take lst max) ", ") ", " (ellipsis)) @@ -404,10 +422,13 @@ (define list->enumeration (cut string-join <> ", "))) (let-values (((new upgraded) (new/upgraded-packages alist1 alist2))) + (define new-count (length new)) + (define upgraded-count (length upgraded)) + (unless (and (null? new) (null? upgraded)) (display heading)) - (match (length new) + (match new-count (0 #t) (count (format #t (N_ " ~h new package: ~a~%" @@ -415,14 +436,20 @@ (define list->enumeration count (pretty (list->enumeration (sort (map first new) stringenumeration (sort upgraded string new-count concise/max-item-count) + (> upgraded-count concise/max-item-count))) + (display-hint (G_ "Run @command{guix pull --news} to view the complete +list of package changes."))))) (define (display-profile-content-diff profile gen1 gen2) "Display the changes in PROFILE GEN2 compared to generation GEN1." @@ -462,7 +489,12 @@ (define (list-generations profile numbers) (() (exit 1)) ((numbers ...) - (list-generations profile numbers))))))))) + (list-generations profile numbers))))))) + (('display-news) + ;; Display profile news, with the understanding that this process + ;; represents the newest generation. + (display-profile-news profile + #:current-is-newer? #t)))) (define (channel-list opts) "Return the list of channels to use. If OPTS specify a channel file, -- cgit v1.2.3 From 5582aa8e31bf88f981caedeb4fbbb758486b6ca7 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Sun, 21 Apr 2019 21:36:47 +0100 Subject: system: Change default kernel-arguments to '("quiet"). This improves the readability of the boot process, especially when using full disk encryption where you're required to enter the passphrase at a particular point. * gnu/system.scm ()[kernel-arguments]: Change the default to '("quiet"). * doc/guix.texi (operating-system Reference): Document this change. --- doc/guix.texi | 2 +- gnu/system.scm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 785329add8..3ec1cf852a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -10461,7 +10461,7 @@ The package object of the operating system kernel to use@footnote{Currently only the Linux-libre kernel is supported. In the future, it will be possible to use the GNU@tie{}Hurd.}. -@item @code{kernel-arguments} (default: @code{'()}) +@item @code{kernel-arguments} (default: @code{'("quiet")}) List of strings or gexps representing additional arguments to pass on the command-line of the kernel---e.g., @code{("console=ttyS0")}. diff --git a/gnu/system.scm b/gnu/system.scm index 24243eb707..c4f5740df2 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -160,7 +160,7 @@ (define-record-type* operating-system (kernel operating-system-kernel ; package (default linux-libre)) (kernel-arguments operating-system-user-kernel-arguments - (default '())) ; list of gexps/strings + (default '("quiet"))) ; list of gexps/strings (bootloader operating-system-bootloader) ; (label operating-system-label ; string (thunked) -- cgit v1.2.3 From 95ef8b85b16f19557ea07d0d0cbf856f85657368 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 23 Apr 2019 14:48:56 +0200 Subject: services: shepherd: Support one-shot services. * gnu/services/shepherd.scm ()[one-shot?]: New field. (shepherd-service-file): Pass #:one-shot? to the constructor. * doc/guix.texi (Shepherd Services): Document it. --- doc/guix.texi | 6 ++++++ gnu/services/shepherd.scm | 10 +++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 3ec1cf852a..955fd1f172 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -25124,6 +25124,12 @@ shepherd, The GNU Shepherd Manual}). @xref{Slots of services, the @item @code{requirements} (default: @code{'()}) List of symbols denoting the Shepherd services this one depends on. +@cindex one-shot services, for the Shepherd +@item @code{one-shot?} (default: @code{#f}) +Whether this service is @dfn{one-shot}. One-shot services stop immediately +after their @code{start} action has completed. @xref{Slots of services,,, +shepherd, The GNU Shepherd Manual}, for more info. + @item @code{respawn?} (default: @code{#t}) Whether to restart the service when it stops, for instance when the underlying process dies. diff --git a/gnu/services/shepherd.scm b/gnu/services/shepherd.scm index 12d649f542..21baacbaf7 100644 --- a/gnu/services/shepherd.scm +++ b/gnu/services/shepherd.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2013, 2014, 2015, 2016, 2018 Ludovic Courtès +;;; Copyright © 2013, 2014, 2015, 2016, 2018, 2019 Ludovic Courtès ;;; Copyright © 2017 Clément Lassieur ;;; Copyright © 2018 Carlo Zancanaro ;;; @@ -44,6 +44,7 @@ (define-module (gnu services shepherd) shepherd-service-provision shepherd-service-canonical-name shepherd-service-requirement + shepherd-service-one-shot? shepherd-service-respawn? shepherd-service-start shepherd-service-stop @@ -149,6 +150,8 @@ (define-record-type* (provision shepherd-service-provision) ;list of symbols (requirement shepherd-service-requirement ;list of symbols (default '())) + (one-shot? shepherd-service-one-shot? ;Boolean + (default #f)) (respawn? shepherd-service-respawn? ;Boolean (default #t)) (start shepherd-service-start) ;g-expression (procedure) @@ -238,6 +241,11 @@ (define (shepherd-service-file service) #:docstring '#$(shepherd-service-documentation service) #:provides '#$(shepherd-service-provision service) #:requires '#$(shepherd-service-requirement service) + + ;; The 'one-shot?' slot is new in Shepherd 0.6.0. + ;; Older versions ignore it. + #:one-shot? '#$(shepherd-service-one-shot? service) + #:respawn? '#$(shepherd-service-respawn? service) #:start #$(shepherd-service-start service) #:stop #$(shepherd-service-stop service) -- cgit v1.2.3 From f6beefafd195e7034a46456d3b4da529c584f055 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 24 Apr 2019 00:35:11 +0200 Subject: doc: Refer to the es and zh_CN translations. * doc/guix.texi (Top): Mention Simplified Chinese and Spanish. --- doc/guix.texi | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 955fd1f172..879cb562e9 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -108,10 +108,11 @@ package management tool written for the GNU system. @c TRANSLATORS: You can replace the following paragraph with information on @c how to join your own translation team and how to report issues with the @c translation. -This manual is also available in French (@pxref{Top,,, guix.fr, Manuel de -référence de GNU Guix}) and German (@pxref{Top,,, guix.de, Referenzhandbuch -zu GNU Guix}). If you would like to translate it in your native language, -consider joining the +This manual is also available in Simplified Chinese (@pxref{Top,,, guix.zh_CN, +GNU Guix参考手册}), French (@pxref{Top,,, guix.fr, Manuel de référence de GNU +Guix}), German (@pxref{Top,,, guix.de, Referenzhandbuch zu GNU Guix}), and +Spanish (@pxref{Top,,, guix.es, Manual de referencia de GNU Guix}). If you +would like to translate it in your native language, consider joining the @uref{https://translationproject.org/domain/guix-manual.html, Translation Project}. -- cgit v1.2.3 From b68aff1f05864a589b62afa44665a99e5cf43718 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Fri, 19 Apr 2019 22:28:30 +0200 Subject: gnu: certbot: Add support for manual plugin. * gnu/services/certbot.scm (certificate-configuration): Add challenge, auth-hook and cleanup-hook fields. (certbot-command): Use them. * doc/guix.texi (Certificate Services): Document them. --- doc/guix.texi | 20 ++++++++++++++++++++ gnu/services/certbot.scm | 40 +++++++++++++++++++++++++++++++--------- 2 files changed, 51 insertions(+), 9 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 879cb562e9..dbbb811a60 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19425,6 +19425,26 @@ Its default is the first provided domain. The first domain provided will be the subject CN of the certificate, and all domains will be Subject Alternative Names on the certificate. +@item @code{challenge} (default: @code{#f}) +The challenge type that has to be run by certbot. If @code{#f} is specified, +default to the HTTP challenge. If a value is specified, defaults to the +manual plugin (see @code{authentication-hook}, @code{cleanup-hook} and +the documentation at @url{https://certbot.eff.org/docs/using.html#hooks}). + +@item @code{authentication-hook} (default: @code{#f}) +Command to be run in a shell once for each certificate challenge to be +answered. For this command, the shell variable @code{$CERTBOT_DOMAIN} +will contain the domain being authenticated, @code{$CERTBOT_VALIDATION} +contains the validation string and @code{$CERTBOT_TOKEN} contains the +file name of the resource requested when performing an HTTP-01 challenge. + +@item @code{cleanup-hook} (default: @code{#f}) +Command to be run in a shell once for each certificate challenge that +have been answered by the @code{auth-hook}. For this command, the shell +variables available in the @code{auth-hook} script are still available, and +additionally @code{$CERTBOT_AUTH_OUTPUT} will contain the standard output +of the @code{auth-hook} script. + @item @code{deploy-hook} (default: @code{#f}) Command to be run in a shell once for each successfully issued certificate. For this command, the shell variable diff --git a/gnu/services/certbot.scm b/gnu/services/certbot.scm index 7565bc97ca..ae34ad17bb 100644 --- a/gnu/services/certbot.scm +++ b/gnu/services/certbot.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2016 ng0 ;;; Copyright © 2016 Sou Bunnbu ;;; Copyright © 2017, 2018 Clément Lassieur +;;; Copyright © 2019 Julien Lepiller ;;; ;;; This file is part of GNU Guix. ;;; @@ -50,6 +51,12 @@ (define-record-type* (default #f)) (domains certificate-configuration-domains (default '())) + (challenge certificate-configuration-challenge + (default #f)) + (authentication-hook certificate-authentication-hook + (default #f)) + (cleanup-hook certificate-cleanup-hook + (default #f)) (deploy-hook certificate-configuration-deploy-hook (default #f))) @@ -81,17 +88,32 @@ (define certbot-command (commands (map (match-lambda - (($ custom-name domains + (($ custom-name domains challenge + authentication-hook cleanup-hook deploy-hook) (let ((name (or custom-name (car domains)))) - (append - (list name certbot "certonly" "-n" "--agree-tos" - "-m" email - "--webroot" "-w" webroot - "--cert-name" name - "-d" (string-join domains ",")) - (if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '()) - (if deploy-hook `("--deploy-hook" ,deploy-hook) '()))))) + (if challenge + (append + (list name certbot "certonly" "-n" "--agree-tos" + "-m" email + "--manual" + (string-append "--preferred-challenges=" challenge) + "--cert-name" name + "-d" (string-join domains ",")) + (if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '()) + (if authentication-hook + `("--manual-auth-hook" ,authentication-hook) + '()) + (if cleanup-hook `("--manual-cleanup-hook" ,cleanup-hook) '()) + (if deploy-hook `("--deploy-hook" ,deploy-hook) '())) + (append + (list name certbot "certonly" "-n" "--agree-tos" + "-m" email + "--webroot" "-w" webroot + "--cert-name" name + "-d" (string-join domains ",")) + (if rsa-key-size `("--rsa-key-size" ,rsa-key-size) '()) + (if deploy-hook `("--deploy-hook" ,deploy-hook) '())))))) certificates))) (program-file "certbot-command" -- cgit v1.2.3 From 92eb600f8a94afa36142f8f145efaa485b632433 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Fri, 19 Apr 2019 22:20:03 +0200 Subject: gnu: knot-service: Add includes field in configuration. * gnu/services/dns.scm (knot-configuration): Add includes field. (verify-knot-configuration): Check includes content. (knot-config-file): Serialize includes. * doc/guix.texi (DNS Services): Document it. --- doc/guix.texi | 13 +++++++++++++ gnu/services/dns.scm | 8 ++++++++ 2 files changed, 21 insertions(+) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index dbbb811a60..2d5ec867ea 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19843,6 +19843,19 @@ The Knot package. @item @code{run-directory} (default: @code{"/var/run/knot"}) The run directory. This directory will be used for pid file and sockets. +@item @code{includes} (default: @code{'()}) +A list of strings or file-like objects denoting other files that must be +included at the top of the configuration file. + +@cindex secrets, Knot service +This can be used to manage secrets out-of-band. For example, secret +keys may be stored in an out-of-band file not managed by Guix, and +thus not visible in @file{/gnu/store}---e.g., you could store secret +key configuration in @file{/etc/knot/secrets.conf} and add this file +to the @code{includes} list. + +It can also be used to add configuration not supported by this interface. + @item @code{listen-v4} (default: @code{"0.0.0.0"}) An ip address on which to listen. diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm index 1ef754b360..445e03570a 100644 --- a/gnu/services/dns.scm +++ b/gnu/services/dns.scm @@ -207,6 +207,8 @@ (define-record-type* (default knot)) (run-directory knot-configuration-run-directory (default "/var/run/knot")) + (includes knot-configuration-includes + (default '())) (listen-v4 knot-configuration-listen-v4 (default "0.0.0.0")) (listen-v6 knot-configuration-listen-v6 @@ -296,6 +298,8 @@ (define (verify-knot-configuration config) (error-out "knot configuration field must be a package.")) (unless (string? (knot-configuration-run-directory config)) (error-out "run-directory must be a string.")) + (unless (list? (knot-configuration-includes config)) + (error-out "includes must be a list of strings or file-like objects.")) (unless (list? (knot-configuration-keys config)) (error-out "keys must be a list of knot-key-configuration.")) (for-each (lambda (key) (verify-knot-key-configuration key)) @@ -529,6 +533,10 @@ (define (knot-config-file config) #~(begin (call-with-output-file #$output (lambda (port) + (if (knot-configuration-includes config) + (for-each (lambda (inc) + (format port "include: ~a\n" inc)) + (knot-configuration-includes config))) (format port "server:\n") (format port " rundir: ~a\n" #$(knot-configuration-run-directory config)) (format port " user: knot\n") -- cgit v1.2.3 From 538b99f31fb3eb41f90d6eb0e658e26e72123553 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 26 Apr 2019 11:39:53 +0200 Subject: system: Provide a new VM image configuration. * gnu/system/examples/vm-image.tmpl: Rewrite. * doc/guix.texi (Running Guix in a VM): Adjust accordingly. --- doc/guix.texi | 26 ++++++---- gnu/system/examples/vm-image.tmpl | 99 +++++++++++++++++++++++++-------------- 2 files changed, 81 insertions(+), 44 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 2d5ec867ea..480fce3933 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -24576,13 +24576,23 @@ example graph. @section Running Guix in a Virtual Machine @cindex virtual machine -To run Guix in a virtual machine (VM), one can either use the -pre-built Guix VM image distributed at +To run Guix in a virtual machine (VM), one can use the pre-built Guix VM image +distributed at @indicateurl{https://alpha.gnu.org/gnu/guix/guix-system-vm-image-@value{VERSION}.@var{system}.xz} -, or build their own virtual machine image using @command{guix system -vm-image} (@pxref{Invoking guix system}). The returned image is in -qcow2 format, which the @uref{http://qemu.org/, QEMU emulator} can -efficiently use. +This image is a compressed image in QCOW format. You will first need to +decompress with @command{xz -d}, and then you can pass it to an emulator such +as QEMU (see below for details). + +This image boots the Xfce graphical environment and it contains some +commonly-used tools. You can install more software in the image by running +@command{guix package} in a terminal (@pxref{Invoking guix package}). You can +also reconfigure the system based on its initial configuration file available +as @file{/etc/config.scm} (@pxref{Using the Configuration System}). + +Instead of using this pre-built image, one can also build their own virtual +machine image using @command{guix system vm-image} (@pxref{Invoking guix +system}). The returned image is in qcow2 format, which the +@uref{http://qemu.org/, QEMU emulator} can efficiently use. @cindex QEMU If you built your own image, you must copy it out of the store @@ -24595,7 +24605,7 @@ vm-image} on x86_64 hardware: @example $ qemu-system-x86_64 \ -net user -net nic,model=virtio \ - -enable-kvm -m 256 /tmp/qemu-image + -enable-kvm -m 512 /tmp/qemu-image @end example Here is what each of these options means: @@ -24621,7 +24631,7 @@ If your system has hardware virtualization extensions, enabling the virtual machine support (KVM) of the Linux kernel will make things run faster. -@item -m 256 +@item -m 512 RAM available to the guest OS, in mebibytes. Defaults to 128@tie{}MiB, which may be insufficient for some operations. diff --git a/gnu/system/examples/vm-image.tmpl b/gnu/system/examples/vm-image.tmpl index 6dc67b0901..d451c42bd8 100644 --- a/gnu/system/examples/vm-image.tmpl +++ b/gnu/system/examples/vm-image.tmpl @@ -1,58 +1,85 @@ -;;; This is an operating system configuration template for a "bare-bones" setup, -;;; suitable for booting in a virtualized environment, including virtual private -;;; servers (VPS). +;; This is an operating system configuration for a VM image. +;; Modify it as you see fit and instantiate the changes by running: +;; +;; guix system reconfigure /etc/config.scm +;; -(use-modules (gnu)) -(use-package-modules bootloaders disk nvi) +(use-modules (gnu) (srfi srfi-1)) +(use-service-modules xorg desktop) +(use-package-modules bootloaders nvi wget xorg) (define vm-image-motd (plain-file "motd" " -This is the GNU system. Welcome! +\x1b[1;37mThis is the GNU system. Welcome!\x1b[0m -This instance of Guix System is a bare-bones template for virtualized environments. +This instance of Guix is a template for virtualized environments. +You can reconfigure the whole system by adjusting /etc/config.scm +and running: -You will probably want to do these things first if you booted in a virtual -private server (VPS): + guix system reconfigure /etc/config.scm + +\x1b[1;33mConsider setting a password for the 'root' and 'guest' \ +accounts.\x1b[0m +")) + +(define this-file + (local-file "./vm-image.tmpl" "config.scm")) -* 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") + (keyboard-layout (keyboard-layout "us" "altgr-intl")) (firmware '()) - ;; Assuming /dev/sdX is the target hard disk, and "my-root" is - ;; the label of the target root file system. + ;; Below we assume /dev/vda is the VM's hard disk. + ;; Adjust as needed. (bootloader (bootloader-configuration (bootloader grub-bootloader) - (target "/dev/sda") + (target "/dev/vda") (terminal-outputs '(console)))) (file-systems (cons (file-system - (device (file-system-label "my-root")) (mount-point "/") + (device "/dev/vda1") (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 (append (list nvi fdisk - ;; mostly so xrefs to its manual work - grub - ;; partprobe - parted) - %base-packages)) - - (services (modify-services %base-services - (login-service-type config => - (login-configuration - (inherit config) - (motd vm-image-motd)))))) + (users (cons (user-account + (name "guest") + (comment "GNU Guix Live") + (password "") ;no password + (group "users") + (supplementary-groups '("wheel" "netdev" + "audio" "video"))) + %base-user-accounts)) + + (packages (append (list nvi wget) %base-packages)) + + (services + (append (list (service xfce-desktop-service-type) + + ;; Copy this file to /etc/config.scm in the OS. + (simple-service 'config-file etc-service-type + `(("config.scm" ,this-file))) + + ;; Choose SLiM, which is lighter than the default GDM. + (service slim-service-type + (slim-configuration + (auto-login? #t) + (default-user "guest") + (xorg-configuration + (xorg-configuration + (keyboard-layout keyboard-layout)))))) + + ;; Remove GDM. + (remove (lambda (service) + (eq? gdm-service-type (service-kind service))) + (modify-services %desktop-services + (login-service-type config => + (login-configuration + (inherit config) + (motd vm-image-motd))))))) + + ;; Allow resolution of '.local' host names with mDNS. + (name-service-switch %mdns-host-lookup-nss)) -- cgit v1.2.3 From b57dd2006b49948d6eca5d07721ec50845d7e354 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 26 Apr 2019 14:16:18 +0200 Subject: doc: Add 'BASE-URL' variable. * doc/guix.texi (BASE-URL): New variable. (Binary Installation, USB Stick and DVD Installation) (Running Guix in a VM): Use it instead of hard-coded URL. --- doc/guix.texi | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 480fce3933..bd59bc6644 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -13,6 +13,9 @@ @set OPENPGP-SIGNING-KEY-ID 3CE464558A84FDC69DB40CFB090B11993D9AEBB5 @set KEY-SERVER pool.sks-keyservers.net +@c Base URL for downloads. +@set BASE-URL https://alpha.gnu.org/gnu/guix + @c The official substitute server used by default. @set SUBSTITUTE-SERVER ci.guix.info @@ -521,7 +524,7 @@ Installing goes along these lines: @item @cindex downloading Guix binary Download the binary tarball from -@indicateurl{https://alpha.gnu.org/gnu/guix/guix-binary-@value{VERSION}.@var{system}.tar.xz}, +@indicateurl{@value{BASE-URL}/guix-binary-@value{VERSION}.@var{system}.tar.xz}, where @var{system} is @code{x86_64-linux} for an @code{x86_64} machine already running the kernel Linux, and so on. @@ -530,7 +533,7 @@ Make sure to download the associated @file{.sig} file and to verify the authenticity of the tarball against it, along these lines: @example -$ wget https://alpha.gnu.org/gnu/guix/guix-binary-@value{VERSION}.@var{system}.tar.xz.sig +$ wget @value{BASE-URL}/guix-binary-@value{VERSION}.@var{system}.tar.xz.sig $ gpg --verify guix-binary-@value{VERSION}.@var{system}.tar.xz.sig @end example @@ -1862,7 +1865,7 @@ about their support in GNU/Linux. An ISO-9660 installation image that can be written to a USB stick or burnt to a DVD can be downloaded from -@indicateurl{https://alpha.gnu.org/gnu/guix/guix-system-install-@value{VERSION}.@var{system}.iso.xz}, +@indicateurl{@value{BASE-URL}/guix-system-install-@value{VERSION}.@var{system}.iso.xz}, where @var{system} is one of: @table @code @@ -1878,7 +1881,7 @@ Make sure to download the associated @file{.sig} file and to verify the authenticity of the image against it, along these lines: @example -$ wget https://alpha.gnu.org/gnu/guix/guix-system-install-@value{VERSION}.@var{system}.iso.xz.sig +$ wget @value{BASE-URL}/guix-system-install-@value{VERSION}.@var{system}.iso.xz.sig $ gpg --verify guix-system-install-@value{VERSION}.@var{system}.iso.xz.sig @end example @@ -24578,7 +24581,7 @@ example graph. @cindex virtual machine To run Guix in a virtual machine (VM), one can use the pre-built Guix VM image distributed at -@indicateurl{https://alpha.gnu.org/gnu/guix/guix-system-vm-image-@value{VERSION}.@var{system}.xz} +@indicateurl{@value{BASE-URL}/guix-system-vm-image-@value{VERSION}.@var{system}.xz} This image is a compressed image in QCOW format. You will first need to decompress with @command{xz -d}, and then you can pass it to an emulator such as QEMU (see below for details). -- cgit v1.2.3 From 272db5bcf53d9d05d5c4b2df021d9e74f78866cd Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 26 Apr 2019 14:18:23 +0200 Subject: doc: Use ftp.gnu.org for downloads. From now on, everything will be uploaded to ftp.gnu.org instead of alpha.gnu.org. * doc/guix.texi (BASE-URL): Switch to ftp.gnu.org. --- doc/guix.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index bd59bc6644..e3bd9915bc 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -14,7 +14,7 @@ @set KEY-SERVER pool.sks-keyservers.net @c Base URL for downloads. -@set BASE-URL https://alpha.gnu.org/gnu/guix +@set BASE-URL https://ftp.gnu.org/gnu/guix @c The official substitute server used by default. @set SUBSTITUTE-SERVER ci.guix.info -- cgit v1.2.3 From 6cd7b1be7ea2b675e369c6cbb35b31b3c496648b Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Sat, 27 Apr 2019 12:56:25 +0200 Subject: gnu: knot: Add configuration fields. * gnu/services/dns.scm (knot-zone-configuration)[zonefile-load] [journal-content, max-journal-usage, max-journal-depth, max-zone-size]: New fields. (knot-zone-config): Serialize them. * doc/guix.texi (DNS Services): Document them. --- doc/guix.texi | 39 +++++++++++++++++++++++++ gnu/services/dns.scm | 80 ++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 95 insertions(+), 24 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index e3bd9915bc..d9473a1820 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -19829,6 +19829,45 @@ When set, this forbids queries of the ANY type. The delay between a modification in memory and on disk. 0 means immediate synchronization. +@item @code{zonefile-load} (default: @code{#f}) +The way the zone file contents are applied during zone load. Possible values +are: + +@itemize +@item @code{#f} for using the default value from Knot, +@item @code{'none} for not using the zone file at all, +@item @code{'difference} for computing the difference between already available +contents and zone contents and applying it to the current zone contents, +@item @code{'difference-no-serial} for the same as @code{'difference}, but +ignoring the SOA serial in the zone file, while the server takes care of it +automatically. +@item @code{'whole} for loading zone contents from the zone file. +@end itemize + +@item @code{journal-content} (default: @code{#f}) +The way the journal is used to store zone and its changes. Possible values +are @code{'none} to not use it at all, @code{'changes} to store changes and +@code{'all} to store contents. @code{#f} does not set this option, so the +default value from Knot is used. + +@item @code{max-journal-usage} (default: @code{#f}) +The maximum size for the journal on disk. @code{#f} does not set this option, +so the default value from Knot is used. + +@item @code{max-journal-depth} (default: @code{#f}) +The maximum size of the history. @code{#f} does not set this option, so the +default value from Knot is used. + +@item @code{max-zone-size} (default: @code{#f}) +The maximum size of the zone file. This limit is enforced for incoming +transfer and updates. @code{#f} does not set this option, so the default +value from Knot is used. + +@item @code{dnssec-policy} (default: @code{#f}) +A reference to a @code{knot-policy-configuration} record, or the special +name @code{"default"}. If the value is @code{#f}, there is no dnssec signing +on this zone. + @item @code{serial-policy} (default: @code{'increment}) A policy between @code{'increment} and @code{'unixtime}. diff --git a/gnu/services/dns.scm b/gnu/services/dns.scm index 3aa97680a9..0d660dea29 100644 --- a/gnu/services/dns.scm +++ b/gnu/services/dns.scm @@ -163,30 +163,40 @@ (define-record-type* (define-record-type* knot-zone-configuration make-knot-zone-configuration knot-zone-configuration? - (domain knot-zone-configuration-domain - (default "")) - (file knot-zone-configuration-file - (default "")) ; the file where this zone is saved. - (zone knot-zone-configuration-zone - (default (zone-file))) ; initial content of the zone file - (master knot-zone-configuration-master - (default '())) - (ddns-master knot-zone-configuration-ddns-master - (default #f)) - (notify knot-zone-configuration-notify - (default '())) - (acl knot-zone-configuration-acl - (default '())) - (semantic-checks? knot-zone-configuration-semantic-checks? - (default #f)) - (disable-any? knot-zone-configuration-disable-any? - (default #f)) - (zonefile-sync knot-zone-configuration-zonefile-sync - (default 0)) - (dnssec-policy knot-zone-configuration-dnssec-policy - (default #f)) - (serial-policy knot-zone-configuration-serial-policy - (default 'increment))) + (domain knot-zone-configuration-domain + (default "")) + (file knot-zone-configuration-file + (default "")) ; the file where this zone is saved. + (zone knot-zone-configuration-zone + (default (zone-file))) ; initial content of the zone file + (master knot-zone-configuration-master + (default '())) + (ddns-master knot-zone-configuration-ddns-master + (default #f)) + (notify knot-zone-configuration-notify + (default '())) + (acl knot-zone-configuration-acl + (default '())) + (semantic-checks? knot-zone-configuration-semantic-checks? + (default #f)) + (disable-any? knot-zone-configuration-disable-any? + (default #f)) + (zonefile-sync knot-zone-configuration-zonefile-sync + (default 0)) + (zonefile-load knot-zone-configuration-zonefile-load + (default #f)) + (journal-content knot-zone-configuration-journal-content + (default #f)) + (max-journal-usage knot-zone-configuration-max-journal-usage + (default #f)) + (max-journal-depth knot-zone-configuration-max-journal-depth + (default #f)) + (max-zone-size knot-zone-configuration-max-zone-size + (default #f)) + (dnssec-policy knot-zone-configuration-dnssec-policy + (default #f)) + (serial-policy knot-zone-configuration-serial-policy + (default 'increment))) (define-record-type* knot-remote-configuration make-knot-remote-configuration @@ -494,6 +504,12 @@ (define (knot-zone-config zone) (acl (list #$@(knot-zone-configuration-acl zone))) (semantic-checks? #$(knot-zone-configuration-semantic-checks? zone)) (disable-any? #$(knot-zone-configuration-disable-any? zone)) + (zone-file-sync #$(knot-zone-configuration-zonefile-sync zone)) + (zone-file-load #$(knot-zone-configuration-zonefile-load zone)) + (journal-content #$(knot-zone-configuration-journal-content zone)) + (max-journal-usage #$(knot-zone-configuration-max-journal-usage zone)) + (max-journal-depth #$(knot-zone-configuration-max-journal-depth zone)) + (max-zone-size #$(knot-zone-configuration-max-zone-size zone)) (dnssec-policy #$(knot-zone-configuration-dnssec-policy zone)) (serial-policy '#$(knot-zone-configuration-serial-policy zone))) (format #t " - domain: ~a\n" domain) @@ -520,6 +536,22 @@ (define (knot-zone-config zone) (knot-zone-configuration-acl zone)))) (format #t " semantic-checks: ~a\n" (if semantic-checks? "on" "off")) (format #t " disable-any: ~a\n" (if disable-any? "on" "off")) + (if zonefile-sync + (format #t " zonefile-sync: ~a\n" zonefile-sync)) + (if zonefile-load + (format #t " zonefile-load: ~a\n" + (symbol->string zonefile-load))) + (if journal-content + (format #t " journal-content: ~a\n" + (symbol->string journal-content))) + (if max-journal-usage + (format #t " max-journal-usage: ~a\n" max-journal-usage)) + (if max-journal-depth + (format #t " max-journal-depth: ~a\n" max-journal-depth)) + (if max-zone-size + (format #t " max-zone-size: ~a\n" max-zone-size)) + (if + (format #t " : ~a\n" )) (if dnssec-policy (begin (format #t " dnssec-signing: on\n") -- cgit v1.2.3 From 05b60752a67af294c35d8f4218487c9a44b5fdee Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 27 Apr 2019 10:09:27 +0200 Subject: doc: Recommend virtio-blk to access the VM image. * doc/guix.texi (Running Guix in a VM): Recommend virtio-blk to access the image. --- doc/guix.texi | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index d9473a1820..de30743d58 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -24647,7 +24647,9 @@ vm-image} on x86_64 hardware: @example $ qemu-system-x86_64 \ -net user -net nic,model=virtio \ - -enable-kvm -m 512 /tmp/qemu-image + -enable-kvm -m 512 \ + -device virtio-blk,drive=myhd \ + -drive if=none,file=/tmp/qemu-image,id=myhd @end example Here is what each of these options means: @@ -24677,8 +24679,15 @@ faster. RAM available to the guest OS, in mebibytes. Defaults to 128@tie{}MiB, which may be insufficient for some operations. -@item /tmp/qemu-image -The file name of the qcow2 image. +@item -device virtio-blk,drive=myhd +Create a @code{virtio-blk} drive called ``myhd''. @code{virtio-blk} is a +``paravirtualization'' mechanism for block devices that allows QEMU to achieve +better performance than if it were emulating a complete disk drive. See the +QEMU and KVM documentation for more info. + +@item -drive if=none,file=/tmp/qemu-image,id=myhd +Use our QCOW image, the @file{/tmp/qemu-image} file, as the backing store the +the ``myhd'' drive. @end table The default @command{run-vm.sh} script that is returned by an invocation of -- cgit v1.2.3 From ea2acfe98a3f3c00d15caa3e899ccbd126b97eb6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 27 Apr 2019 10:15:34 +0200 Subject: doc: Update bit about SSH in the VM. * doc/guix.texi (Running Guix in a VM): Remove mentions of 'lsh-server'; mention 'openssh-service-type' and add a cross-reference. * gnu/system/examples/vm-image.tmpl (services): Add a commented-out line for 'openssh-service-type'. --- doc/guix.texi | 9 ++++----- gnu/system/examples/vm-image.tmpl | 5 ++++- 2 files changed, 8 insertions(+), 6 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index de30743d58..ddd20af256 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -24703,11 +24703,10 @@ network connectivity, for example @command{guix download}. @cindex SSH @cindex SSH server -To enable SSH inside a VM you need to add a SSH server like @code{(dropbear-service)} -or @code{(lsh-service)} to your VM. The @code{(lsh-service}) doesn't currently -boot unsupervised. It requires you to type some characters to initialize the -randomness generator. In addition you need to forward the SSH port, 22 by -default, to the host. You can do this with +To enable SSH inside a VM you need to add an SSH server like +@code{openssh-service-type} to your VM (@pxref{Networking Services, +@code{openssh-service-type}}). In addition you need to forward the SSH port, +22 by default, to the host. You can do this with @example `guix system vm config.scm` -net user,hostfwd=tcp::10022-:22 diff --git a/gnu/system/examples/vm-image.tmpl b/gnu/system/examples/vm-image.tmpl index b6f9daaf61..9bc08fa635 100644 --- a/gnu/system/examples/vm-image.tmpl +++ b/gnu/system/examples/vm-image.tmpl @@ -5,7 +5,7 @@ ;; (use-modules (gnu) (srfi srfi-1)) -(use-service-modules desktop networking xorg) +(use-service-modules desktop networking ssh xorg) (use-package-modules bootloaders nvi wget xorg) (define vm-image-motd (plain-file "motd" " @@ -73,6 +73,9 @@ accounts.\x1b[0m (xorg-configuration (keyboard-layout keyboard-layout))))) + ;; Uncomment the line below to add an SSH server. + ;;(service openssh-service-type) + ;; Use the DHCP client service rather than NetworkManager. (service dhcp-client-service-type)) -- cgit v1.2.3 From 68400dfafa7b6e85cd2d03d2b2b531df2af28bc1 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 27 Apr 2019 14:58:58 +0200 Subject: doc: Suggest 1G of RAM for the VM image. * doc/guix.texi (Running Guix in a VM): Suggest -m 1024. --- doc/guix.texi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index ddd20af256..238fe9741f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -24675,7 +24675,8 @@ If your system has hardware virtualization extensions, enabling the virtual machine support (KVM) of the Linux kernel will make things run faster. -@item -m 512 +@c To run Xfce + 'guix pull', we need at least 1G of RAM. +@item -m 1024 RAM available to the guest OS, in mebibytes. Defaults to 128@tie{}MiB, which may be insufficient for some operations. -- cgit v1.2.3 From 339586e402493df5c21e72f91820b8f91a82c559 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 27 Apr 2019 19:15:19 +0200 Subject: doc: Remove outdated paragraph in "Binary Installation". This is a followup to e9926f80c6553fde50ce1fcfd38d6370f841efd2. * doc/guix.texi (Binary Installation): Remove paragraph about not removing 'guix' from root's profile. --- doc/guix.texi | 6 ------ 1 file changed, 6 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 238fe9741f..4f43db3443 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -683,12 +683,6 @@ the root profile: # guix package -i hello @end example -The @code{guix} package must remain available in @code{root}'s profile, -or it would become subject to garbage collection---in which case you -would find yourself badly handicapped by the lack of the @command{guix} -command. In other words, do not remove @code{guix} by running -@code{guix package -r guix}. - The binary installation tarball can be (re)produced and verified simply by running the following command in the Guix source tree: -- cgit v1.2.3 From 0fe169220050db9eb0b271e2afebe70ccd070ab9 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 28 Apr 2019 18:25:05 +0200 Subject: doc: Duplicate recommendation about 'guix-install.sh'. Since our web site points to "Binary Installation", it's best to have that note there. * doc/guix.texi (Binary Installation): Add note about guix-install.sh. --- doc/guix.texi | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 4f43db3443..c28ded1cf1 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -518,6 +518,15 @@ dependencies. This is often quicker than installing from source, which is described in the next sections. The only requirement is to have GNU@tie{}tar and Xz. +@c Note duplicated from the ``Installation'' node. +@quotation Note +We recommend the use of this +@uref{https://git.savannah.gnu.org/cgit/guix.git/plain/etc/guix-install.sh, +shell installer script}. The script automates the download, installation, and +initial configuration steps described below. It should be run as the root +user. +@end quotation + Installing goes along these lines: @enumerate -- cgit v1.2.3 From d824cfbabeb0780c9ea7a6dab02c47b6a4d029c6 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sat, 27 Apr 2019 18:04:00 +0200 Subject: guix package: Add 'install', 'remove', and 'upgrade' aliases. * guix/scripts/install.scm, guix/scripts/remove.scm, guix/scripts/upgrade.scm, tests/guix-package-aliases.sh: New files. * Makefile.am (MODULES, SH_TESTS): Add them. * po/guix/POTFILES.in: Add them. * guix/scripts/package.scm (guix-package): Split with... (guix-package*): ... this. New procedure. * doc/guix.texi (Invoking guix package): Document them. (Binary Installation, Application Setup, Package Management) (Packages with Multiple Outputs, Package Modules) (X.509 Certificates, Installing Debugging Files): Use 'guix install' in simple examples. * etc/completion/bash/guix (_guix_complete): Handle "install", "remove", and "upgrade". --- Makefile.am | 4 ++ doc/guix.texi | 39 +++++++++++++------ etc/completion/bash/guix | 11 +++++- guix/scripts/install.scm | 80 +++++++++++++++++++++++++++++++++++++++ guix/scripts/package.scm | 11 +++++- guix/scripts/remove.scm | 77 +++++++++++++++++++++++++++++++++++++ guix/scripts/upgrade.scm | 88 +++++++++++++++++++++++++++++++++++++++++++ po/guix/POTFILES.in | 3 ++ tests/guix-package-aliases.sh | 58 ++++++++++++++++++++++++++++ 9 files changed, 358 insertions(+), 13 deletions(-) create mode 100644 guix/scripts/install.scm create mode 100644 guix/scripts/remove.scm create mode 100644 guix/scripts/upgrade.scm create mode 100644 tests/guix-package-aliases.sh (limited to 'doc/guix.texi') diff --git a/Makefile.am b/Makefile.am index 05940719cd..076f1c7a71 100644 --- a/Makefile.am +++ b/Makefile.am @@ -224,6 +224,9 @@ MODULES = \ guix/scripts/archive.scm \ guix/scripts/import.scm \ guix/scripts/package.scm \ + guix/scripts/install.scm \ + guix/scripts/remove.scm \ + guix/scripts/upgrade.scm \ guix/scripts/gc.scm \ guix/scripts/hash.scm \ guix/scripts/pack.scm \ @@ -425,6 +428,7 @@ SH_TESTS = \ tests/guix-pack-localstatedir.sh \ tests/guix-pack-relocatable.sh \ tests/guix-package.sh \ + tests/guix-package-aliases.sh \ tests/guix-package-net.sh \ tests/guix-system.sh \ tests/guix-archive.sh \ diff --git a/doc/guix.texi b/doc/guix.texi index c28ded1cf1..6c3dc7d208 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -689,7 +689,7 @@ You can confirm that Guix is working by installing a sample package into the root profile: @example -# guix package -i hello +# guix install hello @end example The binary installation tarball can be (re)produced and verified simply @@ -1577,7 +1577,7 @@ available with Guix and then define the @code{GUIX_LOCPATH} environment variable: @example -$ guix package -i glibc-locales +$ guix install glibc-locales $ export GUIX_LOCPATH=$HOME/.guix-profile/lib/locale @end example @@ -1677,7 +1677,7 @@ Multiple Outputs}). For instance, the following command installs fonts for Chinese languages: @example -guix package -i font-adobe-source-han-sans:cn +guix install font-adobe-source-han-sans:cn @end example @cindex @code{xterm} @@ -2492,7 +2492,7 @@ emacs-guix, The Emacs-Guix Reference Manual}), after installing with it): @example -guix package -i emacs-guix +guix install emacs-guix @end example @menu @@ -2610,6 +2610,7 @@ is: @example guix package @var{options} @end example + @cindex transactions Primarily, @var{options} specifies the operations to be performed during the transaction. Upon completion, a new profile is created, but @@ -2623,6 +2624,22 @@ For example, to remove @code{lua} and install @code{guile} and guix package -r lua -i guile guile-cairo @end example +@cindex aliases, for @command{guix package} +For your convenience, we also provide the following aliases: + +@itemize +@item +@command{guix install} is an alias for @command{guix package -i}, +@item +@command{guix remove} is an alias for @command{guix package -r}, +@item +and @command{guix upgrade} is an alias for @command{guix package -u}. +@end itemize + +These aliases are less expressive than @command{guix package} and provide +fewer options, so in some cases you'll probably want to use @command{guix +package} directly. + @command{guix package} also supports a @dfn{declarative approach} whereby the user specifies the exact set of packages to be available and passes it @i{via} the @option{--manifest} option @@ -3312,7 +3329,7 @@ like to discuss this project, join us on @email{guix-devel@@gnu.org}. Often, packages defined in Guix have a single @dfn{output}---i.e., the source package leads to exactly one directory in the store. When running -@command{guix package -i glibc}, one installs the default output of the +@command{guix install glibc}, one installs the default output of the GNU libc package; the default output is called @code{out}, but its name can be omitted as shown in this command. In this particular case, the default output of @code{glibc} contains all the C header files, shared @@ -3328,14 +3345,14 @@ separate output, called @code{doc}. To install the main GLib output, which contains everything but the documentation, one would run: @example -guix package -i glib +guix install glib @end example @cindex documentation The command to install its documentation is: @example -guix package -i glib:doc +guix install glib:doc @end example Some packages install programs with different ``dependency footprints''. @@ -4986,7 +5003,7 @@ module exports a variable named @code{emacs}, which is bound to a The @code{(gnu packages @dots{})} module name space is automatically scanned for packages by the command-line tools. For -instance, when running @code{guix package -i emacs}, all the @code{(gnu +instance, when running @code{guix install emacs}, all the @code{(gnu packages @dots{})} modules are scanned until one that exports a package object whose name is @code{emacs} is found. This package search facility is implemented in the @code{(gnu packages)} module. @@ -23634,7 +23651,7 @@ pointed to by the @code{GIT_SSL_CAINFO} environment variable. Thus, you would typically run something like: @example -$ guix package -i nss-certs +$ guix install nss-certs $ export SSL_CERT_DIR="$HOME/.guix-profile/etc/ssl/certs" $ export SSL_CERT_FILE="$HOME/.guix-profile/etc/ssl/certs/ca-certificates.crt" $ export GIT_SSL_CAINFO="$SSL_CERT_FILE" @@ -23645,7 +23662,7 @@ variable to point to a certificate bundle, so you would have to run something like this: @example -$ guix package -i nss-certs +$ guix install nss-certs $ export CURL_CA_BUNDLE="$HOME/.guix-profile/etc/ssl/certs/ca-certificates.crt" @end example @@ -25427,7 +25444,7 @@ installs the debugging information for the GNU C Library and for GNU Guile: @example -guix package -i glibc:debug guile:debug +guix install glibc:debug guile:debug @end example GDB must then be told to look for debug files in the user's profile, by diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix index 3d2b3ddda7..edfb627e87 100644 --- a/etc/completion/bash/guix +++ b/etc/completion/bash/guix @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2015, 2016, 2017, 2018 Ludovic Courtès +# Copyright © 2015, 2016, 2017, 2018, 2019 Ludovic Courtès # # This file is part of GNU Guix. # @@ -167,6 +167,15 @@ _guix_complete () else _guix_complete_available_package "$word_at_point" fi + elif _guix_is_command "install" + then + _guix_complete_available_package "$word_at_point" + elif _guix_is_command "remove" + then + _guix_complete_installed_package "$word_at_point" + elif _guix_is_command "upgrade" + then + _guix_complete_installed_package "$word_at_point" elif _guix_is_command "build" then if _guix_is_dash_L diff --git a/guix/scripts/install.scm b/guix/scripts/install.scm new file mode 100644 index 0000000000..d88e86e77a --- /dev/null +++ b/guix/scripts/install.scm @@ -0,0 +1,80 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Ludovic Courtès +;;; +;;; 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 (guix scripts install) + #:use-module (guix ui) + #:use-module (guix scripts package) + #:use-module (guix scripts build) + #:use-module (guix scripts) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + #:use-module (srfi srfi-37) + #:export (guix-install)) + +(define (show-help) + (display (G_ "Usage: guix install [OPTION] PACKAGES... +Install the given PACKAGES. +This is an alias for 'guix package -i'.\n")) + (display (G_ " + -p, --profile=PROFILE use PROFILE instead of the user's default profile")) + ;; '--bootstrap' not shown here. + (display (G_ " + -v, --verbosity=LEVEL use the given verbosity LEVEL")) + (newline) + (show-build-options-help) + (newline) + (show-transformation-options-help) + (newline) + (display (G_ " + -h, --help display this help and exit")) + (display (G_ " + -V, --version display version information and exit")) + (newline) + (show-bug-report-information)) + +(define %options + ;; Specification of the command-line options. + (cons* (option '(#\h "help") #f #f + (lambda args + (show-help) + (exit 0))) + (option '(#\V "version") #f #f + (lambda args + (show-version-and-exit "guix install"))) + + ;; Preserve some of the 'guix package' options. + (append (filter (lambda (option) + (any (cut member <> (option-names option)) + '("profile" "dry-run" "verbosity" "bootstrap"))) + %package-options) + + %transformation-options + %standard-build-options))) + +(define (guix-install . args) + (define (handle-argument arg result arg-handler) + ;; Treat all non-option arguments as package specs. + (values (alist-cons 'install arg result) + arg-handler)) + + (define opts + (parse-command-line args %options + (list %package-default-options #f) + #:argument-handler handle-argument)) + + (guix-package* opts)) diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 564236988e..aa27984ea2 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -58,7 +58,11 @@ (define-module (guix scripts package) delete-generations delete-matching-generations display-search-paths - guix-package)) + guix-package + + (%options . %package-options) + (%default-options . %package-default-options) + guix-package*)) (define %store (make-parameter #f)) @@ -899,6 +903,11 @@ (define opts (parse-command-line args %options (list %default-options #f) #:argument-handler handle-argument)) + (guix-package* opts)) + +(define (guix-package* opts) + "Run the 'guix package' command on OPTS, an alist resulting for command-line +option processing with 'parse-command-line'." (with-error-handling (or (process-query opts) (parameterize ((%store (open-connection)) diff --git a/guix/scripts/remove.scm b/guix/scripts/remove.scm new file mode 100644 index 0000000000..2f06ea4f37 --- /dev/null +++ b/guix/scripts/remove.scm @@ -0,0 +1,77 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Ludovic Courtès +;;; +;;; 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 (guix scripts remove) + #:use-module (guix ui) + #:use-module (guix scripts package) + #:use-module (guix scripts build) + #:use-module (guix scripts) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + #:use-module (srfi srfi-37) + #:export (guix-remove)) + +(define (show-help) + (display (G_ "Usage: guix remove [OPTION] PACKAGES... +Remove the given PACKAGES. +This is an alias for 'guix package -r'.\n")) + (display (G_ " + -p, --profile=PROFILE use PROFILE instead of the user's default profile")) + ;; '--bootstrap' not shown here. + (display (G_ " + -v, --verbosity=LEVEL use the given verbosity LEVEL")) + (newline) + (show-build-options-help) + (newline) + (display (G_ " + -h, --help display this help and exit")) + (display (G_ " + -V, --version display version information and exit")) + (newline) + (show-bug-report-information)) + +(define %options + ;; Specification of the command-line options. + (cons* (option '(#\h "help") #f #f + (lambda args + (show-help) + (exit 0))) + (option '(#\V "version") #f #f + (lambda args + (show-version-and-exit "guix remove"))) + + ;; Preserve some of the 'guix package' options. + (append (filter (lambda (option) + (any (cut member <> (option-names option)) + '("profile" "dry-run" "verbosity" "bootstrap"))) + %package-options) + + %standard-build-options))) + +(define (guix-remove . args) + (define (handle-argument arg result arg-handler) + ;; Treat all non-option arguments as package specs. + (values (alist-cons 'remove arg result) + arg-handler)) + + (define opts + (parse-command-line args %options + (list %package-default-options #f) + #:argument-handler handle-argument)) + + (guix-package* opts)) diff --git a/guix/scripts/upgrade.scm b/guix/scripts/upgrade.scm new file mode 100644 index 0000000000..7f14a2fdbe --- /dev/null +++ b/guix/scripts/upgrade.scm @@ -0,0 +1,88 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Ludovic Courtès +;;; +;;; 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 (guix scripts upgrade) + #:use-module (guix ui) + #:use-module (guix scripts package) + #:use-module (guix scripts build) + #:use-module (guix scripts) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + #:use-module (srfi srfi-37) + #:use-module (ice-9 match) + #:export (guix-upgrade)) + +(define (show-help) + (display (G_ "Usage: guix upgrade [OPTION] [REGEXP] +Upgrade packages that match REGEXP. +This is an alias for 'guix package -u'.\n")) + (display (G_ " + -p, --profile=PROFILE use PROFILE instead of the user's default profile")) + (display (G_ " + -v, --verbosity=LEVEL use the given verbosity LEVEL")) + (newline) + (show-build-options-help) + (newline) + (show-transformation-options-help) + (newline) + (display (G_ " + -h, --help display this help and exit")) + (display (G_ " + -V, --version display version information and exit")) + (newline) + (show-bug-report-information)) + +(define %options + ;; Specification of the command-line options. + (cons* (option '(#\h "help") #f #f + (lambda args + (show-help) + (exit 0))) + (option '(#\V "version") #f #f + (lambda args + (show-version-and-exit "guix upgrade"))) + + ;; Preserve some of the 'guix package' options. + (append (filter (lambda (option) + (any (cut member <> (option-names option)) + '("profile" "dry-run" "verbosity"))) + %package-options) + + %transformation-options + %standard-build-options))) + +(define (guix-upgrade . args) + (define (handle-argument arg result arg-handler) + ;; Accept at most one non-option argument, and treat it as an upgrade + ;; regexp. + (match (assq-ref result 'upgrade) + (#f + (values (alist-cons 'upgrade arg + (alist-delete 'upgrade result)) + arg-handler)) + (_ + (leave (G_ "~A: extraneous argument~%") arg)))) + + (define opts + (parse-command-line args %options + (list `((upgrade . #f) + ,@%package-default-options) + #f) + #:argument-handler handle-argument)) + + (guix-package* opts)) diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in index a2c89db981..91de60efc7 100644 --- a/po/guix/POTFILES.in +++ b/po/guix/POTFILES.in @@ -41,6 +41,9 @@ guix/scripts/build.scm guix/discovery.scm guix/scripts/download.scm guix/scripts/package.scm +guix/scripts/install.scm +guix/scripts/remove.scm +guix/scripts/upgrade.scm guix/scripts/gc.scm guix/scripts/hash.scm guix/scripts/import.scm diff --git a/tests/guix-package-aliases.sh b/tests/guix-package-aliases.sh new file mode 100644 index 0000000000..64ed2fbb67 --- /dev/null +++ b/tests/guix-package-aliases.sh @@ -0,0 +1,58 @@ +# GNU Guix --- Functional package management for GNU +# Copyright © 2019 Ludovic Courtès +# +# 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 . + +# +# Test the `guix package' aliases. +# + +guix install --version + +readlink_base () +{ + basename `readlink "$1"` +} + +profile="t-profile-$$" +rm -f "$profile" + +trap 'rm -f "$profile" "$profile-"[0-9]*' EXIT + +guix install --bootstrap guile-bootstrap -p "$profile" +test -x "$profile/bin/guile" + +# Make sure '-r' isn't passed as-is to 'guix package'. +if guix install -r guile-bootstrap -p "$profile" --bootstrap +then false; else true; fi +test -x "$profile/bin/guile" + +guix upgrade --version +guix upgrade -n +guix upgrade gui.e -n +if guix upgrade foo bar -n; +then false; else true; fi + +guix remove --version +guix remove --bootstrap guile-bootstrap -p "$profile" +! test -x "$profile/bin/guile" +test `guix package -p "$profile" -I | wc -l` -eq 0 + +if guix remove -p "$profile" this-is-not-installed --bootstrap +then false; else true; fi + +if guix remove -i guile-bootstrap -p "$profile" --bootstrap +then false; else true; fi -- cgit v1.2.3 From 20dbd858ad955004ebd3e15e1aa04b05f303c36b Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 29 Apr 2019 10:54:43 +0200 Subject: doc: Add 'SUBSTITUTE-URL' variable. * doc/guix.texi (SUBSTITUTE-SERVER): New variable. (Invoking guix weather): Use it. --- doc/guix.texi | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 6c3dc7d208..513f518926 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -18,6 +18,7 @@ @c The official substitute server used by default. @set SUBSTITUTE-SERVER ci.guix.info +@set SUBSTITUTE-URL https://@value{SUBSTITUTE-SERVER} @copying Copyright @copyright{} 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019 Ludovic Courtès@* @@ -10107,14 +10108,14 @@ on @var{a} and @var{a} has no substitutes, only @var{a} is listed, even though @var{b} usually lacks substitutes as well. The result looks like this: @example -$ guix weather --substitute-urls=https://ci.guix.info -c 10 +$ guix weather --substitute-urls=@value{SUBSTITUTE-URL} -c 10 computing 8,983 package derivations for x86_64-linux... -looking for 9,343 store items on https://ci.guix.info... -updating substitutes from 'https://ci.guix.info'... 100.0% -https://ci.guix.info +looking for 9,343 store items on @value{SUBSTITUTE-URL}... +updating substitutes from '@value{SUBSTITUTE-URL}'... 100.0% +@value{SUBSTITUTE-URL} 64.7% substitutes available (6,047 out of 9,343) @dots{} -2502 packages are missing from 'https://ci.guix.info' for 'x86_64-linux', among which: +2502 packages are missing from '@value{SUBSTITUTE-URL}' for 'x86_64-linux', among which: 58 kcoreaddons@@5.49.0 /gnu/store/@dots{}-kcoreaddons-5.49.0 46 qgpgme@@1.11.1 /gnu/store/@dots{}-qgpgme-1.11.1 37 perl-http-cookiejar@@0.008 /gnu/store/@dots{}-perl-http-cookiejar-0.008 -- cgit v1.2.3 From e432ce1b8575b6559c04457010ca8554c5b7ba5f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 29 Apr 2019 11:17:39 +0200 Subject: doc: Remove traces of "Guix System Distribution". * doc/guix.texi (Invoking guix package) (Official Substitute Server, System Configuration): Replace "the Guix System Distribution" by "Guix System". --- doc/guix.texi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 513f518926..8f6e5bc20c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2653,7 +2653,7 @@ current generation of the user's default profile. Thus, users can add @file{$HOME/.guix-profile/bin} to their @code{PATH} environment variable, and so on. @cindex search paths -If you are not using the Guix System Distribution, consider adding the +If you are not using Guix System, consider adding the following lines to your @file{~/.bash_profile} (@pxref{Bash Startup Files,,, bash, The GNU Bash Reference Manual}) so that newly-spawned shells get all the right environment variable definitions: @@ -3140,7 +3140,7 @@ could use the information gathered to determine, for instance, whether your system has unpatched security vulnerabilities. Substitutes from the official build farm are enabled by default when -using the Guix System Distribution (@pxref{GNU Distribution}). However, +using Guix System (@pxref{GNU Distribution}). However, they are disabled by default when using Guix on a foreign distribution, unless you have explicitly enabled them via one of the recommended installation steps (@pxref{Installation}). The following paragraphs @@ -10192,7 +10192,7 @@ ClientCommand: cuirass --cache-directory /var/cache/cuirass @dots{} @chapter System Configuration @cindex system configuration -The Guix System Distribution supports a consistent whole-system configuration +Guix System supports a consistent whole-system configuration mechanism. By that we mean that all aspects of the global system configuration---such as the available system services, timezone and locale settings, user accounts---are declared in a single place. Such -- cgit v1.2.3 From 9d3053819dfd834a1c29a03427c41d8524b8a7d5 Mon Sep 17 00:00:00 2001 From: rendaw <7e9wc56emjakcm@s.rendaw.me> Date: Mon, 29 Apr 2019 12:08:51 +0200 Subject: file-systems: Support the 'no-atime' flag. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * guix/build/syscalls.scm (MS_NOATIME): New variable. * gnu/build/file-systems.scm (mount-flags->bit-mask): Support it. * doc/guix.texi (File Systems): Document it and add cross-references to the relevant documentation. Co-authored-by: Ludovic Courtès --- doc/guix.texi | 9 +++++++-- gnu/build/file-systems.scm | 2 ++ guix/build/syscalls.scm | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 8f6e5bc20c..39d2ee476a 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -10753,10 +10753,15 @@ corresponding device mapping established. This is a list of symbols denoting mount flags. Recognized flags include @code{read-only}, @code{bind-mount}, @code{no-dev} (disallow access to special files), @code{no-suid} (ignore setuid and setgid -bits), and @code{no-exec} (disallow program execution.) +bits), @code{no-atime} (do not update file access times), and @code{no-exec} +(disallow program execution). @xref{Mount-Unmount-Remount,,, libc, The GNU C +Library Reference Manual}, for more information on these flags. @item @code{options} (default: @code{#f}) -This is either @code{#f}, or a string denoting mount options. +This is either @code{#f}, or a string denoting mount options passed to the +file system driver. @xref{Mount-Unmount-Remount,,, libc, The GNU C Library +Reference Manual}, for details and run @command{man 8 mount} for options for +various file systems. @item @code{mount?} (default: @code{#t}) This value indicates whether to automatically mount the file system when diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm index c468144170..8bb10d574d 100644 --- a/gnu/build/file-systems.scm +++ b/gnu/build/file-systems.scm @@ -575,6 +575,8 @@ (define (mount-flags->bit-mask flags) (logior MS_NODEV (loop rest))) (('no-exec rest ...) (logior MS_NOEXEC (loop rest))) + (('no-atime rest ...) + (logior MS_NOATIME (loop rest))) (() 0)))) diff --git a/guix/build/syscalls.scm b/guix/build/syscalls.scm index 66d63a2931..3316dc8dc5 100644 --- a/guix/build/syscalls.scm +++ b/guix/build/syscalls.scm @@ -39,6 +39,7 @@ (define-module (guix build syscalls) MS_NODEV MS_NOEXEC MS_REMOUNT + MS_NOATIME MS_BIND MS_MOVE MS_STRICTATIME @@ -451,6 +452,7 @@ (define MS_NOSUID 2) (define MS_NODEV 4) (define MS_NOEXEC 8) (define MS_REMOUNT 32) +(define MS_NOATIME 1024) (define MS_BIND 4096) (define MS_MOVE 8192) (define MS_STRICTATIME 16777216) -- cgit v1.2.3 From da56f10971e0b6f32969b10e38ed043b2c99bb82 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 29 Apr 2019 10:41:11 +0200 Subject: guix package: Add 'guix search' alias. * guix/scripts/search.scm: New file. * Makefile.am (MODULES): Add it. * po/guix/POTFILES.in: Add it. * tests/guix-package-aliases.sh: Add test. * doc/guix.texi (Invoking guix package): Document it and use it in a couple of examples. --- Makefile.am | 1 + doc/guix.texi | 13 +++++---- guix/scripts/search.scm | 67 +++++++++++++++++++++++++++++++++++++++++++ po/guix/POTFILES.in | 1 + tests/guix-package-aliases.sh | 2 ++ 5 files changed, 79 insertions(+), 5 deletions(-) create mode 100644 guix/scripts/search.scm (limited to 'doc/guix.texi') diff --git a/Makefile.am b/Makefile.am index 076f1c7a71..36f3bc5c27 100644 --- a/Makefile.am +++ b/Makefile.am @@ -227,6 +227,7 @@ MODULES = \ guix/scripts/install.scm \ guix/scripts/remove.scm \ guix/scripts/upgrade.scm \ + guix/scripts/search.scm \ guix/scripts/gc.scm \ guix/scripts/hash.scm \ guix/scripts/pack.scm \ diff --git a/doc/guix.texi b/doc/guix.texi index 39d2ee476a..fcee57d9cd 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2630,6 +2630,8 @@ For your convenience, we also provide the following aliases: @itemize @item +@command{guix search} is an alias for @command{guix package -s}, +@item @command{guix install} is an alias for @command{guix package -i}, @item @command{guix remove} is an alias for @command{guix package -r}, @@ -2953,12 +2955,13 @@ name: gmp @dots{} @end example -It is also possible to refine search results using several @code{-s} -flags. For example, the following command returns a list of board -games: +It is also possible to refine search results using several @code{-s} flags to +@command{guix package}, or several arguments to @command{guix search}. For +example, the following command returns a list of board games (this time using +the @command{guix search} alias): @example -$ guix package -s '\' -s game | recsel -p name +$ guix search '\' game | recsel -p name name: gnubg @dots{} @end example @@ -2973,7 +2976,7 @@ for cryptographic libraries, filters out Haskell, Perl, Python, and Ruby libraries, and prints the name and synopsis of the matching packages: @example -$ guix package -s crypto -s library | \ +$ guix search crypto library | \ recsel -e '! (name ~ "^(ghc|perl|python|ruby)")' -p name,synopsis @end example diff --git a/guix/scripts/search.scm b/guix/scripts/search.scm new file mode 100644 index 0000000000..8fceb83668 --- /dev/null +++ b/guix/scripts/search.scm @@ -0,0 +1,67 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2019 Ludovic Courtès +;;; +;;; 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 (guix scripts search) + #:use-module (guix ui) + #:use-module (guix scripts package) + #:use-module (guix scripts) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) + #:use-module (srfi srfi-37) + #:export (guix-search)) + +(define (show-help) + (display (G_ "Usage: guix search [OPTION] REGEXPS... +Search for packages matching REGEXPS.")) + (display (G_" +This is an alias for 'guix package -s'.\n")) + (newline) + (display (G_ " + -h, --help display this help and exit")) + (display (G_ " + -V, --version display version information and exit")) + (newline) + (show-bug-report-information)) + +(define %options + ;; Specification of the command-line options. + (list (option '(#\h "help") #f #f + (lambda args + (show-help) + (exit 0))) + (option '(#\V "version") #f #f + (lambda args + (show-version-and-exit "guix search"))))) + +(define (guix-search . args) + (define (handle-argument arg result) + ;; Treat all non-option arguments as regexps. + (cons `(query search ,(or arg "")) + result)) + + (define opts + (args-fold* args %options + (lambda (opt name arg . rest) + (leave (G_ "~A: unrecognized option~%") name)) + handle-argument + '())) + + (unless (assoc-ref opts 'query) + (leave (G_ "missing arguments: no regular expressions to search for~%"))) + + (guix-package* opts)) diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in index 91de60efc7..ceee589b2e 100644 --- a/po/guix/POTFILES.in +++ b/po/guix/POTFILES.in @@ -44,6 +44,7 @@ guix/scripts/package.scm guix/scripts/install.scm guix/scripts/remove.scm guix/scripts/upgrade.scm +guix/scripts/search.scm guix/scripts/gc.scm guix/scripts/hash.scm guix/scripts/import.scm diff --git a/tests/guix-package-aliases.sh b/tests/guix-package-aliases.sh index 64ed2fbb67..5c68664093 100644 --- a/tests/guix-package-aliases.sh +++ b/tests/guix-package-aliases.sh @@ -56,3 +56,5 @@ then false; else true; fi if guix remove -i guile-bootstrap -p "$profile" --bootstrap then false; else true; fi + +guix search '\' game | grep '^name: gnubg' -- cgit v1.2.3