From 7d193ec34881843573a8013163347cfd8b1e9001 Mon Sep 17 00:00:00 2001 From: Eric Bavier Date: Sun, 20 Jul 2014 11:29:48 -0500 Subject: guix: refresh: Add --list-dependent option. * guix/packages.scm (package-direct-inputs): New procedure. * gnu/packages.scm (vhash-refq, package-direct-dependents) (package-transitive-dependents, package-covering-dependents): New procedures. * guix/scripts/refresh.scm (%options, show-help, guix-refresh): Add --list-dependent option. * doc/guix.texi (Invoking guix refresh): Document '--list-dependent' option. --- doc/guix.texi | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 5bee540460..8431cbd907 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2545,6 +2545,31 @@ The command above specifically updates the @code{emacs} and @code{idutils} packages. The @code{--select} option would have no effect in this case. +When considering whether to upgrade a package, it is sometimes +convenient to know which packages would be affected by the upgrade and +should be checked for compatibility. For this the following option may +be used when passing @command{guix refresh} one or more package names: + +@table @code + +@item --list-dependent +@itemx -l +List top-level dependent packages that would need to be rebuilt as a +result of upgrading one or more packages. + +@end table + +Be aware that the @code{--list-dependent} option only +@emph{approximates} the rebuilds that would be required as a result of +an upgrade. More rebuilds might be required under some circumstances. + +@example +guix refresh --list-dependent flex +@end example + +The command above lists a set of packages that could be built to check +for compatibility with an upgraded @code{flex} package. + The following options can be used to customize GnuPG operation: @table @code -- cgit v1.2.3 From 7779ab611da79cced8fecc0b423577bf0836dc0f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Sun, 20 Jul 2014 22:03:03 +0200 Subject: doc: Show output of 'guix refresh --list-dependent' example. * doc/guix.texi (Invoking guix refresh): Show example output of the command. --- doc/guix.texi | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 8431cbd907..d30142fcbe 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2564,7 +2564,9 @@ Be aware that the @code{--list-dependent} option only an upgrade. More rebuilds might be required under some circumstances. @example -guix refresh --list-dependent flex +$ guix refresh --list-dependent flex +Building the following 120 packages would ensure 213 dependent packages are rebuilt: +hop-2.4.0 geiser-0.4 notmuch-0.18 mu-0.9.9.5 cflow-1.4 idutils-4.6 @dots{} @end example The command above lists a set of packages that could be built to check -- cgit v1.2.3 From 2aa6efb0b9952595853c05294450b4254f64521e Mon Sep 17 00:00:00 2001 From: Cyril Roelandt Date: Thu, 17 Jul 2014 02:36:09 +0200 Subject: guix package: add a "show" option. * doc/guix.texi: Update the documentation. * guix/scripts/package.scm: Add a "show" option. * tests/guix-package.sh: Add a test for the "show" option. --- doc/guix.texi | 24 ++++++++++++++++++++++++ guix/scripts/package.scm | 15 +++++++++++++++ tests/guix-package.sh | 3 +++ 3 files changed, 42 insertions(+) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index d30142fcbe..ab9a533047 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -844,6 +844,30 @@ name: gmp @dots{} @end example +@item --show=@var{package} +Show details about @var{package}, taken from the list of available packages, in +@code{recutils} format (@pxref{Top, GNU recutils databases,, recutils, GNU +recutils manual}). + +@example +$ guix package --show=python | recsel -p name,version +name: python +version: 2.7.6 + +name: python +version: 3.3.5 +@end example + +You may also specify the full name of a package to only get details about a +specific version of it: +@example +$ guix package --show=python-3.3.5 | recsel -p name,version +name: python +version: 3.3.5 +@end example + + + @item --list-installed[=@var{regexp}] @itemx -I [@var{regexp}] List the currently installed packages in the specified profile, with the diff --git a/guix/scripts/package.scm b/guix/scripts/package.scm index 1c3209f905..0d17414b4f 100644 --- a/guix/scripts/package.scm +++ b/guix/scripts/package.scm @@ -517,6 +517,8 @@ (define (show-help) (display (_ " -A, --list-available[=REGEXP] list available packages matching REGEXP")) + (display (_ " + --show=PACKAGE show details about PACKAGE")) (newline) (show-build-options-help) (newline) @@ -615,6 +617,11 @@ (define %options (values (cons `(query list-available ,(or arg "")) result) #f))) + (option '("show") #t #t + (lambda (opt name arg result arg-handler) + (values (cons `(query show ,arg) + result) + #f))) %standard-build-options)) @@ -1042,6 +1049,14 @@ (define (list-generation number) (find-packages-by-description regexp))) #t)) + (('show requested-name) + (let-values (((name version) + (package-name->name+version requested-name))) + (leave-on-EPIPE + (for-each (cute package->recutils <> (current-output-port)) + (find-packages-by-name name version))) + #t)) + (('search-paths) (let* ((manifest (profile-manifest profile)) (entries (manifest-entries manifest)) diff --git a/tests/guix-package.sh b/tests/guix-package.sh index 4d75955411..6b99275240 100644 --- a/tests/guix-package.sh +++ b/tests/guix-package.sh @@ -176,6 +176,9 @@ then false; else true; fi # Check whether `--list-available' returns something sensible. guix package -p "$profile" -A 'gui.*e' | grep guile +# Check whether `--show' returns something sensible. +guix package --show=guile | grep "^Package: guile" + # There's no generation older than 12 months, so the following command should # have no effect. generation="`readlink_base "$profile"`" -- cgit v1.2.3 From 7cb9666dd05ba4f039a151c5189a533139f26109 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 22 Jul 2014 15:23:14 +0200 Subject: doc: Fix typo. * doc/guix.texi (System Installation): s/are/is/. --- 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 ab9a533047..fb6f897bb2 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2709,7 +2709,7 @@ GNOME and KDE. @item Support for encrypted disks, the Logical Volume Manager (LVM), and swap -devices are missing. +devices is missing. @item Few system services are currently supported out-of-the-box -- cgit v1.2.3 From a69576ea858863574252cbefbcef91db98773d60 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 22 Jul 2014 16:57:57 +0200 Subject: system: Add '%devtmpfs-file-system' for udev, and '%base-file-systems'. Suggested by Adam Pribyl . * gnu/services/base.scm (udev-service)[requirement]: Add 'file-system-/dev'. * gnu/system/file-systems.scm (%devtmpfs-file-system, %base-file-systems): New variables. * gnu/system/install.scm (installation-services)[file-systems]: Use %base-file-systems. * build-aux/hydra/demo-os.scm (file-systems): Likewise. * doc/guix.texi (System Installation): Show %BASE-FILE-SYSTEMS in the example. (Using the Configuration System): Likewise. (File Systems): Document %base-file-systems, %devtmpfs-file-system, %binary-format-file-system, and %fuse-control-file-system. --- build-aux/hydra/demo-os.scm | 14 +++++++------- doc/guix.texi | 37 +++++++++++++++++++++++++++++++++---- gnu/services/base.scm | 9 +++++++-- gnu/system/file-systems.scm | 18 +++++++++++++++++- gnu/system/install.scm | 5 +++-- 5 files changed, 67 insertions(+), 16 deletions(-) (limited to 'doc/guix.texi') diff --git a/build-aux/hydra/demo-os.scm b/build-aux/hydra/demo-os.scm index 89b67aabe3..9164500d70 100644 --- a/build-aux/hydra/demo-os.scm +++ b/build-aux/hydra/demo-os.scm @@ -44,13 +44,13 @@ (file-systems ;; We provide a dummy file system for /, but that's OK because the VM build ;; code will automatically declare the / file system for us. - (list (file-system - (mount-point "/") - (device "dummy") - (type "dummy")) - ;; %fuse-control-file-system ; needs fuse.ko - ;; %binary-format-file-system ; needs binfmt.ko - )) + (cons* (file-system + (mount-point "/") + (device "dummy") + (type "dummy")) + ;; %fuse-control-file-system ; needs fuse.ko + ;; %binary-format-file-system ; needs binfmt.ko + %base-file-systems)) (users (list (user-account (name "guest") diff --git a/doc/guix.texi b/doc/guix.texi index fb6f897bb2..2b05a75be4 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2826,10 +2826,11 @@ only a root account would look like this: ;; Assuming /dev/sdX is the target hard disk, and /dev/sdX1 the ;; target root file system. (bootloader (grub-configuration (device "/dev/sdX"))) - (file-systems (list (file-system + (file-systems (cons (file-system (device "/dev/sdX1") (mount-point "/") - (type "ext4"))))) + (type "ext4")) + %base-file-systems))) @end example @noindent @@ -2925,10 +2926,11 @@ kernel, initial RAM disk, and boot loader looks like this: (locale "fr_FR.UTF-8") (bootloader (grub-configuration (device "/dev/sda"))) - (file-systems (list (file-system + (file-systems (cons (file-system (device "/dev/sda1") ; or partition label (mount-point "/") - (type "ext3")))) + (type "ext3")) + %base-file-systems)) (users (list (user-account (name "alice") (password "") @@ -3055,6 +3057,32 @@ errors before being mounted. @end table @end deftp +The @code{(gnu system file-systems)} exports the following useful +variables. + +@defvr {Scheme Variable} %base-file-systems +These are essential file systems that are required on normal systems, +such as @var{%devtmpfs-file-system} (see below.) Operating system +declarations should always contain at least these. +@end defvr + +@defvr {Scheme Variable} %devtmpfs-file-system +The @code{devtmpfs} file system to be mounted on @file{/dev}. This is a +requirement for udev (@pxref{Base Services, @code{udev-service}}). +@end defvr + +@defvr {Scheme Variable} %binary-format-file-system +The @code{binfmt_misc} file system, which allows handling of arbitrary +executable file types to be delegated to user space. This requires the +@code{binfmt.ko} kernel module to be loaded. +@end defvr + +@defvr {Scheme Variable} %fuse-control-file-system +The @code{fusectl} file system, which allows unprivileged users to mount +and unmount user-space FUSE file systems. This requires the +@code{fuse.ko} kernel module to be loaded. +@end defvr + @node User Accounts @subsection User Accounts @@ -3245,6 +3273,7 @@ passed to @command{guix-daemon}. Run @var{udev}, which populates the @file{/dev} directory dynamically. @end deffn + @node Networking Services @subsubsection Networking Services diff --git a/gnu/services/base.scm b/gnu/services/base.scm index ae12c8e93d..42e232c9ac 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -473,8 +473,13 @@ (define* (udev-service #:key (udev udev)) (with-monad %store-monad (return (service (provision '(udev)) - (requirement '(root-file-system)) - (documentation "Populate the /dev directory.") + + ;; Udev needs /dev to be a 'devtmpfs' mount so that new device + ;; nodes can be added: see + ;; . + (requirement '(root-file-system file-system-/dev)) + + (documentation "Populate the /dev directory, dynamically.") (start #~(lambda () (define udevd (string-append #$udev "/libexec/udev/udevd")) diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index 7852a6ab26..0c2021d7b4 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -30,7 +30,10 @@ (define-module (gnu system file-systems) file-system-options %fuse-control-file-system - %binary-format-file-system)) + %binary-format-file-system + %devtmpfs-file-system + + %base-file-systems)) ;;; Commentary: ;;; @@ -72,4 +75,17 @@ (define %binary-format-file-system (type "binfmt_misc") (check? #f))) +(define %devtmpfs-file-system + ;; /dev as a 'devtmpfs' file system, needed for udev. + (file-system + (device "none") + (mount-point "/dev") + (type "devtmpfs") + (check? #f))) + +(define %base-file-systems + ;; List of basic file systems to be mounted. Note that /proc and /sys are + ;; currently mounted by the initrd. + (list %devtmpfs-file-system)) + ;;; file-systems.scm ends here diff --git a/gnu/system/install.scm b/gnu/system/install.scm index 18fd587ead..d4a32609ba 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -117,10 +117,11 @@ (define installation-os (file-systems ;; Note: the disk image build code overrides this root file system with ;; the appropriate one. - (list (file-system + (cons (file-system (mount-point "/") (device "gnu-disk-image") - (type "ext4")))) + (type "ext4")) + %base-file-systems)) (users (list (user-account (name "guest") -- cgit v1.2.3 From 4e469051a77d02435eafb1df93224a2ce1bb3146 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 22 Jul 2014 22:53:36 +0200 Subject: system: Add 'create-mount-point?' file system option. * gnu/system/file-systems.scm ()[create-mount-point?]: New field. * gnu/services/base.scm (file-system-service): Add #:create-mount-point? parameter and honor it. * gnu/system.scm (other-file-system-services): Update 'file-system-service' call accordingly. * doc/guix.texi (File Systems): Document it. --- doc/guix.texi | 3 +++ gnu/services/base.scm | 9 +++++++-- gnu/system.scm | 3 ++- gnu/system/file-systems.scm | 6 +++++- 4 files changed, 17 insertions(+), 4 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 2b05a75be4..a88b546380 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3054,6 +3054,9 @@ instance, for the root file system. This Boolean indicates whether the file system needs to be checked for errors before being mounted. +@item @code{create-mount-point?} (default: @code{#f}) +When true, the mount point is created if it does not exist yet. + @end table @end deftp diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 42e232c9ac..9a67109db0 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -96,11 +96,13 @@ (define (root-file-system-service) (respawn? #f))))) (define* (file-system-service device target type - #:key (check? #t) options (title 'any)) + #:key (check? #t) create-mount-point? + options (title 'any)) "Return a service that mounts DEVICE on TARGET as a file system TYPE with OPTIONS. TITLE is a symbol specifying what kind of name DEVICE is: 'label for a partition label, 'device for a device file name, or 'any. When CHECK? is -true, check the file system before mounting it." +true, check the file system before mounting it. When CREATE-MOUNT-POINT? is +true, create TARGET if it does not exist yet." (with-monad %store-monad (return (service @@ -109,6 +111,9 @@ (define* (file-system-service device target type (documentation "Check, mount, and unmount the given file system.") (start #~(lambda args (let ((device (canonicalize-device-spec #$device '#$title))) + #$(if create-mount-point? + #~(mkdir-p #$target) + #~#t) #$(if check? #~(begin ;; Make sure fsck.ext2 & co. can be found. diff --git a/gnu/system.scm b/gnu/system.scm index 20942ec7f0..8c6fc13059 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -181,10 +181,11 @@ (define file-systems (sequence %store-monad (map (match-lambda (($ device title target type flags opts - #f check?) + #f check? create?) (file-system-service device target type #:title title #:check? check? + #:create-mount-point? create? #:options opts))) file-systems))) diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index 0c2021d7b4..ea8d961317 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -28,6 +28,8 @@ (define-module (gnu system file-systems) file-system-needed-for-boot? file-system-flags file-system-options + file-system-check? + file-system-create-mount-point? %fuse-control-file-system %binary-format-file-system @@ -57,7 +59,9 @@ (define-record-type* file-system (needed-for-boot? file-system-needed-for-boot? ; Boolean (default #f)) (check? file-system-check? ; Boolean - (default #t))) + (default #t)) + (create-mount-point? file-system-create-mount-point? ; Boolean + (default #f))) (define %fuse-control-file-system ;; Control file system for Linux' file systems in user-space (FUSE). -- cgit v1.2.3 From 7f239fd33ff7bf2f1ec48de37f14479699d4096f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 22 Jul 2014 23:13:53 +0200 Subject: system: Add 'file-system' decl. for /dev/pts, and use the right options. Fixes . * gnu/system/file-systems.scm (%devtmpfs-file-system): Add 'needed-for-boot?' field. (%tty-gid, %pseudo-terminal-file-system): New variables. (%base-file-systems): Add %PSEUDO-TERMINAL-FILE-SYSTEM. * gnu/services/base.scm (udev-service): Remove dependency on 'file-system-/dev'. * gnu/system/shadow.scm (%base-groups): Add 'id' field for group 'tty'. * guix/build/linux-initrd.scm (boot-system): Remove 'mount' call for /dev/pts. * doc/guix.texi (File Systems): Add %pseudo-terminal-file-system. --- doc/guix.texi | 8 ++++++++ gnu/services/base.scm | 2 +- gnu/system/file-systems.scm | 26 ++++++++++++++++++++++++-- gnu/system/shadow.scm | 4 +++- guix/build/linux-initrd.scm | 5 ----- 5 files changed, 36 insertions(+), 9 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index a88b546380..4490ff1deb 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3074,6 +3074,14 @@ The @code{devtmpfs} file system to be mounted on @file{/dev}. This is a requirement for udev (@pxref{Base Services, @code{udev-service}}). @end defvr +@defvr {Scheme Variable} %pseudo-terminal-file-system +This is the file system to be mounted as @file{/dev/pts}. It supports +@dfn{pseudo-terminals} created @i{via} @code{openpty} and similar +functions (@pxref{Pseudo-Terminals,,, libc, The GNU C Library Reference +Manual}). Pseudo-terminals are used by terminal emulators such as +@command{xterm}. +@end defvr + @defvr {Scheme Variable} %binary-format-file-system The @code{binfmt_misc} file system, which allows handling of arbitrary executable file types to be delegated to user space. This requires the diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 9a67109db0..2c9054af48 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -482,7 +482,7 @@ (define* (udev-service #:key (udev udev)) ;; Udev needs /dev to be a 'devtmpfs' mount so that new device ;; nodes can be added: see ;; . - (requirement '(root-file-system file-system-/dev)) + (requirement '(root-file-system)) (documentation "Populate the /dev directory, dynamically.") (start #~(lambda () diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index ea8d961317..76460d95af 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -85,11 +85,33 @@ (define %devtmpfs-file-system (device "none") (mount-point "/dev") (type "devtmpfs") - (check? #f))) + (check? #f) + + ;; Mount it from the initrd so /dev/pts & co. can then be mounted over it. + (needed-for-boot? #t))) + +(define %tty-gid + ;; ID of the 'tty' group. Allocate it statically to make it easy to refer + ;; to it from here and from the 'tty' group definitions. + 1004) + +(define %pseudo-terminal-file-system + ;; The pseudo-terminal file system. It needs to be mounted so that + ;; statfs(2) returns DEVPTS_SUPER_MAGIC like libc's getpt(3) expects (and + ;; thus openpty(3) and its users, such as xterm.) + (file-system + (device "none") + (mount-point "/dev/pts") + (type "devpts") + (check? #f) + (needed-for-boot? #f) + (create-mount-point? #t) + (options (string-append "gid=" (number->string %tty-gid) ",mode=620")))) (define %base-file-systems ;; List of basic file systems to be mounted. Note that /proc and /sys are ;; currently mounted by the initrd. - (list %devtmpfs-file-system)) + (list %devtmpfs-file-system + %pseudo-terminal-file-system)) ;;; file-systems.scm ends here diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index ae6eac9a5b..e29dbb8c3e 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -20,6 +20,8 @@ (define-module (gnu system shadow) #:use-module (guix records) #:use-module (guix gexp) #:use-module (guix monads) + #:use-module ((gnu system file-systems) + #:select (%tty-gid)) #:use-module ((gnu packages admin) #:select (shadow)) #:use-module (gnu packages bash) @@ -84,7 +86,7 @@ (define %base-groups ;; The following groups are conventionally used by things like udev to ;; control access to hardware devices. - (user-group (name "tty")) + (user-group (name "tty") (id %tty-gid)) (user-group (name "dialout")) (user-group (name "kmem")) (user-group (name "video")) diff --git a/guix/build/linux-initrd.scm b/guix/build/linux-initrd.scm index abf86f6a77..08df32ad1e 100644 --- a/guix/build/linux-initrd.scm +++ b/guix/build/linux-initrd.scm @@ -670,11 +670,6 @@ (define root-fs-type (switch-root "/root") (format #t "loading '~a'...\n" to-load) - ;; Obviously this has to be done each time we boot. Do it from here - ;; so that statfs(2) returns DEVPTS_SUPER_MAGIC like libc's getpt(3) - ;; expects (and thus openpty(3) and its users, such as xterm.) - (mount "none" "/dev/pts" "devpts") - ;; TODO: Remove /lib, /share, and /loader.go. (primitive-load to-load) -- cgit v1.2.3 From a85b83d2270673fdb00d03bbec7e3378c6adcac2 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 22 Jul 2014 23:28:53 +0200 Subject: doc: Merge the type, variable, and function indices. * doc/guix.texi (Function Index): Rename to... (Programming Index): ... this. Merge the type, variable, and function indices. --- doc/guix.texi | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 4490ff1deb..f475a172fe 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -67,7 +67,7 @@ package management tool written for the GNU system. * Acknowledgments:: Thanks! * GNU Free Documentation License:: The license of this manual. * Concept Index:: Concepts. -* Function Index:: Functions. +* Programming Index:: Data types, functions, and variables. @end menu @c ********************************************************************* @@ -4131,8 +4131,10 @@ an inspiration for Guix. @unnumbered Concept Index @printindex cp -@node Function Index -@unnumbered Function Index +@node Programming Index +@unnumbered Programming Index +@syncodeindex tp fn +@syncodeindex vr fn @printindex fn @bye -- cgit v1.2.3 From 2c071ce96e7e4049be3ae2eb958077566d3b4ea0 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 23 Jul 2014 00:44:27 +0200 Subject: system: Recognize more file system flags. * guix/build/linux-initrd.scm (MS_NOSUID, MS_NODEV, MS_NOEXEC): New variables. (mount-flags->bit-mask): New procedure. (mount-file-system)[flags->bit-mask]: Remove. Use 'mount-flags->bit-mask' instead. In /etc/mtab, use the empty string when OPTIONS is false. * gnu/services/base.scm (file-system-service): Add #:flags parameter and honor it. * gnu/system.scm (other-file-system-services): Pass FLAGS to 'file-system-service'. --- doc/guix.texi | 4 +++- gnu/services/base.scm | 13 +++++++++---- gnu/system.scm | 3 ++- guix/build/linux-initrd.scm | 35 ++++++++++++++++++++++++----------- 4 files changed, 38 insertions(+), 17 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index f475a172fe..42e62d4648 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3039,7 +3039,9 @@ partitions without having to hard-code their actual device name. @item @code{flags} (default: @code{'()}) This is a list of symbols denoting mount flags. Recognized flags -include @code{read-only} and @code{bind-mount}. +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.) @item @code{options} (default: @code{#f}) This is either @code{#f}, or a string denoting mount options. diff --git a/gnu/services/base.scm b/gnu/services/base.scm index 2c9054af48..342b3c1488 100644 --- a/gnu/services/base.scm +++ b/gnu/services/base.scm @@ -29,6 +29,8 @@ (define-module (gnu services base) #:use-module ((gnu packages base) #:select (glibc-final)) #:use-module (gnu packages package-management) + #:use-module ((guix build linux-initrd) + #:select (mount-flags->bit-mask)) #:use-module (guix gexp) #:use-module (guix monads) #:use-module (srfi srfi-1) @@ -96,13 +98,14 @@ (define (root-file-system-service) (respawn? #f))))) (define* (file-system-service device target type - #:key (check? #t) create-mount-point? - options (title 'any)) + #:key (flags '()) (check? #t) + create-mount-point? options (title 'any)) "Return a service that mounts DEVICE on TARGET as a file system TYPE with OPTIONS. TITLE is a symbol specifying what kind of name DEVICE is: 'label for a partition label, 'device for a device file name, or 'any. When CHECK? is true, check the file system before mounting it. When CREATE-MOUNT-POINT? is -true, create TARGET if it does not exist yet." +true, create TARGET if it does not exist yet. FLAGS is a list of symbols, +such as 'read-only' etc." (with-monad %store-monad (return (service @@ -124,7 +127,9 @@ (define* (file-system-service device target type (getenv "PATH"))) (check-file-system device #$type)) #~#t) - (mount device #$target #$type 0 #$options)) + (mount device #$target #$type + #$(mount-flags->bit-mask flags) + #$options)) #t)) (stop #~(lambda args ;; Normally there are no processes left at this point, so diff --git a/gnu/system.scm b/gnu/system.scm index 8c6fc13059..4648d810a3 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -186,7 +186,8 @@ (define file-systems #:title title #:check? check? #:create-mount-point? create? - #:options opts))) + #:options opts + #:flags flags))) file-systems))) (define (essential-services os) diff --git a/guix/build/linux-initrd.scm b/guix/build/linux-initrd.scm index 08df32ad1e..662f7967e3 100644 --- a/guix/build/linux-initrd.scm +++ b/guix/build/linux-initrd.scm @@ -40,6 +40,7 @@ (define-module (guix build linux-initrd) find-partition-by-label canonicalize-device-spec + mount-flags->bit-mask check-file-system mount-file-system bind-mount @@ -393,6 +394,9 @@ (define* (configure-qemu-networking #:optional (interface "eth0")) ;; Linux mount flags, from libc's . (define MS_RDONLY 1) +(define MS_NOSUID 2) +(define MS_NODEV 4) +(define MS_NOEXEC 8) (define MS_BIND 4096) (define MS_MOVE 8192) @@ -494,6 +498,24 @@ (define fsck fsck code device) (start-repl))))) +(define (mount-flags->bit-mask flags) + "Return the number suitable for the 'flags' argument of 'mount' that +corresponds to the symbols listed in FLAGS." + (let loop ((flags flags)) + (match flags + (('read-only rest ...) + (logior MS_RDONLY (loop rest))) + (('bind-mount rest ...) + (logior MS_BIND (loop rest))) + (('no-suid rest ...) + (logior MS_NOSUID (loop rest))) + (('no-dev rest ...) + (logior MS_NODEV (loop rest))) + (('no-exec rest ...) + (logior MS_NOEXEC (loop rest))) + (() + 0)))) + (define* (mount-file-system spec #:key (root "/root")) "Mount the file system described by SPEC under ROOT. SPEC must have the form: @@ -503,15 +525,6 @@ (define* (mount-file-system spec #:key (root "/root")) DEVICE, MOUNT-POINT, and TYPE must be strings; OPTIONS can be a string or #f; FLAGS must be a list of symbols. CHECK? is a Boolean indicating whether to run a file system check." - (define flags->bit-mask - (match-lambda - (('read-only rest ...) - (or MS_RDONLY (flags->bit-mask rest))) - (('bind-mount rest ...) - (or MS_BIND (flags->bit-mask rest))) - (() - 0))) - (match spec ((source title mount-point type (flags ...) options check?) (let ((source (canonicalize-device-spec source title)) @@ -519,7 +532,7 @@ (define flags->bit-mask (when check? (check-file-system source type)) (mkdir-p mount-point) - (mount source mount-point type (flags->bit-mask flags) + (mount source mount-point type (mount-flags->bit-mask flags) (if options (string->pointer options) %null-pointer)) @@ -528,7 +541,7 @@ (define flags->bit-mask (mkdir-p (string-append root "/etc")) (let ((port (open-file (string-append root "/etc/mtab") "a"))) (format port "~a ~a ~a ~a 0 0~%" - source mount-point type options) + source mount-point type (or options "")) (close-port port)))))) (define (switch-root root) -- cgit v1.2.3 From db17ae5c27c614731b849cc4acc6a2857060c771 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Wed, 23 Jul 2014 01:25:01 +0200 Subject: system: Add /dev/shm. * gnu/system/file-systems.scm (%shared-memory-file-system): New variable. (%base-file-systems): Add it. * doc/guix.texi (File Systems): Document it. --- doc/guix.texi | 6 ++++++ gnu/system/file-systems.scm | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 42e62d4648..7bc10dc566 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3084,6 +3084,12 @@ Manual}). Pseudo-terminals are used by terminal emulators such as @command{xterm}. @end defvr +@defvr {Scheme Variable} %shared-memory-file-system +This file system is mounted as @file{/dev/shm} and is used to support +memory sharing across processes (@pxref{Memory-mapped I/O, +@code{shm_open},, libc, The GNU C Library Reference Manual}). +@end defvr + @defvr {Scheme Variable} %binary-format-file-system The @code{binfmt_misc} file system, which allows handling of arbitrary executable file types to be delegated to user space. This requires the diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index 76460d95af..8700530a76 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -108,10 +108,22 @@ (define %pseudo-terminal-file-system (create-mount-point? #t) (options (string-append "gid=" (number->string %tty-gid) ",mode=620")))) +(define %shared-memory-file-system + ;; Shared memory. + (file-system + (device "tmpfs") + (mount-point "/dev/shm") + (type "tmpfs") + (check? #f) + (flags '(no-suid no-dev)) + (options "size=50%") ;TODO: make size configurable + (create-mount-point? #t))) + (define %base-file-systems ;; List of basic file systems to be mounted. Note that /proc and /sys are ;; currently mounted by the initrd. (list %devtmpfs-file-system - %pseudo-terminal-file-system)) + %pseudo-terminal-file-system + %shared-memory-file-system)) ;;; file-systems.scm ends here -- cgit v1.2.3 From 83a17b62363c85f05a0916e9b7493d9d58ce7196 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Tue, 22 Jul 2014 22:12:05 +0200 Subject: install: Add a service to back the store with the target disk. Fixes . Reported by Adam Pribyl . * gnu/services/dmd.scm (dmd-configuration-file)[config]: Import (guix build utils). * gnu/system/install.scm (make-cow-store, cow-store-service): New procedures. (installation-services): Use it. (%backing-directory): New variable. * doc/guix.texi (System Installation): Add the 'deco start cow-store /mnt' phase. --- doc/guix.texi | 11 +++++++- gnu/services/dmd.scm | 1 + gnu/system/install.scm | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+), 1 deletion(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 7bc10dc566..6266f70194 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2799,9 +2799,18 @@ The installation image includes Parted (@pxref{Overview,,, parted, GNU Parted User Manual}), @command{fdisk}, and e2fsprogs, the suite of tools to manipulate ext2/ext3/ext4 file systems. +@item +Once that is done, mount the target root partition under @file{/mnt}. + +@item +Lastly, run @code{deco start cow-store /mnt}. + +This will make @file{/gnu/store} copy-on-write, such that packages added +to it during the installation phase will be written to the target disk +rather than kept in memory. + @end enumerate -Once that is done, mount the target root partition under @file{/mnt}. @subsection Proceeding with the Installation diff --git a/gnu/services/dmd.scm b/gnu/services/dmd.scm index 74adb27885..dfda2708f5 100644 --- a/gnu/services/dmd.scm +++ b/gnu/services/dmd.scm @@ -49,6 +49,7 @@ (define config (use-modules (ice-9 ftw) (guix build syscalls) + (guix build utils) ((guix build linux-initrd) #:select (check-file-system canonicalize-device-spec))) diff --git a/gnu/system/install.scm b/gnu/system/install.scm index d4a32609ba..d3539b3f84 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -20,6 +20,7 @@ (define-module (gnu system install) #:use-module (gnu) #:use-module (guix gexp) #:use-module (guix monads) + #:use-module ((guix store) #:select (%store-prefix)) #:use-module (gnu packages linux) #:use-module (gnu packages package-management) #:use-module (gnu packages disk) @@ -42,6 +43,78 @@ (define (log-to-info) "-f" (string-append #$guix "/share/info/guix.info") "-n" "System Installation"))) +(define %backing-directory + ;; Sub-directory used as the backing store for copy-on-write. + "/tmp/guix-inst") + +(define (make-cow-store target) + "Return a gexp that makes the store copy-on-write, using TARGET as the +backing store. This is useful when TARGET is on a hard disk, whereas the +current store is on a RAM disk." + (define (unionfs read-only read-write mount-point) + ;; Make MOUNT-POINT the union of READ-ONLY and READ-WRITE. + + ;; Note: in the command below, READ-WRITE appears before READ-ONLY so that + ;; it is considered a "higher-level branch", as per unionfs-fuse(8), + ;; thereby allowing files existing on READ-ONLY to be copied over to + ;; READ-WRITE. + #~(fork+exec-command + (list (string-append #$unionfs-fuse "/bin/unionfs") + "-o" + "cow,allow_other,use_ino,max_files=65536,nonempty" + (string-append #$read-write "=RW:" #$read-only "=RO") + #$mount-point))) + + (define (set-store-permissions directory) + ;; Set the right perms on DIRECTORY to use it as the store. + #~(begin + (chown #$directory 0 30000) ;use the fixed 'guixbuild' GID + (chmod #$directory #o1775))) + + #~(begin + (unless (file-exists? "/.ro-store") + (mkdir "/.ro-store") + (mount #$(%store-prefix) "/.ro-store" "none" + (logior MS_BIND MS_RDONLY))) + + (let ((rw-dir (string-append target #$%backing-directory))) + (mkdir-p rw-dir) + (mkdir-p "/.rw-store") + #$(set-store-permissions #~rw-dir) + #$(set-store-permissions "/.rw-store") + + ;; Mount the union, then atomically make it the store. + (and #$(unionfs "/.ro-store" #~rw-dir "/.rw-store") + (begin + (sleep 1) ;XXX: wait for unionfs to be ready + (mount "/.rw-store" #$(%store-prefix) "" MS_MOVE) + (rmdir "/.rw-store")))))) + +(define (cow-store-service) + "Return a service that makes the store copy-on-write, such that writes go to +the user's target storage device rather than on the RAM disk." + ;; See for the initial report. + (with-monad %store-monad + (return (service + (requirement '(root-file-system user-processes)) + (provision '(cow-store)) + (documentation + "Make the store copy-on-write, with writes going to \ +the given target.") + (start #~(case-lambda + ((target) + #$(make-cow-store #~target) + target) + (else + ;; Do nothing, and mark the service as stopped. + #f))) + (stop #~(lambda (target) + ;; Delete the temporary directory, but leave everything + ;; mounted as there may still be processes using it + ;; since 'user-processes' doesn't depend on us. + (delete-file-recursively + (string-append target #$%backing-directory)))))))) + (define (installation-services) "Return the list services for the installation image." (let ((motd (text-file "motd" " @@ -88,6 +161,10 @@ (define (normal-tty tty) ;; Start udev so that useful device nodes are available. (udev-service) + ;; Add the 'cow-store' service, which users have to start manually + ;; since it takes the installation directory as an argument. + (cow-store-service) + ;; Install Unicode support and a suitable font. (console-font-service "tty1") (console-font-service "tty2") -- cgit v1.2.3 From 7ab44369b34a23e5d22ac51b7fbfe31c0de9fbfd Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 24 Jul 2014 19:47:48 +0200 Subject: doc: Recommend partition labels. * doc/guix.texi (System Installation): Recommend partition labels. --- 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 6266f70194..2f44ce9506 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2795,6 +2795,11 @@ image does not contain all the software and tools that may be needed. Unless this has already been done, you must partition and format the target partitions. +Preferably, assign partitions a label so that you can easily and +reliably refer to them in @code{file-system} declarations (@pxref{File +Systems}). This is typically done using the @code{-L} option of +@command{mkfs.ext4} and related commands. + The installation image includes Parted (@pxref{Overview,,, parted, GNU Parted User Manual}), @command{fdisk}, and e2fsprogs, the suite of tools to manipulate ext2/ext3/ext4 file systems. -- cgit v1.2.3 From 0a90af153199b03deced53da7ef7f50f0e561f80 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 24 Jul 2014 22:27:35 +0200 Subject: monads: Add 'interned-file'. * guix/monads.scm (interned-file): New procedure. * tests/monads.scm ("interned-file"): New test. * doc/guix.texi (The Store Monad): Document it. --- doc/guix.texi | 23 +++++++++++++++++++++++ guix/monads.scm | 13 +++++++++++++ tests/monads.scm | 10 ++++++++++ 3 files changed, 46 insertions(+) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 2f44ce9506..c504a5d0ba 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2012,6 +2012,29 @@ will references @var{coreutils}, @var{grep}, and @var{sed}, thereby preventing them from being garbage-collected during its lifetime. @end deffn +@deffn {Monadic Procedure} interned-file @var{file} [@var{name}] @ + [#:recursive? #t] +Return the name of @var{file} once interned in the store. Use +@var{name} as its store name, or the basename of @var{file} if +@var{name} is omitted. + +When @var{recursive?} is true, the contents of @var{file} are added +recursively; if @var{file} designates a flat file and @var{recursive?} +is true, its contents are added, and its permission bits are kept. + +The example below adds a file to the store, under two different names: + +@example +(run-with-store (open-connection) + (mlet %store-monad ((a (interned-file "README")) + (b (interned-file "README" "LEGU-MIN"))) + (return (list a b)))) + +@result{} ("/gnu/store/rwm@dots{}-README" "/gnu/store/44i@dots{}-LEGU-MIN") +@end example + +@end deffn + @deffn {Monadic Procedure} package-file @var{package} [@var{file}] @ [#:system (%current-system)] [#:output "out"] Return as a monadic value in the absolute file name of @var{file} within the @var{output} diff --git a/guix/monads.scm b/guix/monads.scm index c2c6f1a03d..4af2b704ab 100644 --- a/guix/monads.scm +++ b/guix/monads.scm @@ -55,6 +55,7 @@ (define-module (guix monads) run-with-store text-file text-file* + interned-file package-file origin->derivation package->derivation @@ -362,6 +363,18 @@ (define (builder inputs) (derivation-expression name (builder inputs) #:inputs inputs))) +(define* (interned-file file #:optional name + #:key (recursive? #t)) + "Return the name of FILE once interned in the store. Use NAME as its store +name, or the basename of FILE if NAME is omitted. + +When RECURSIVE? is true, the contents of FILE are added recursively; if FILE +designates a flat file and RECURSIVE? is true, its contents are added, and its +permission bits are kept." + (lambda (store) + (add-to-store store (or name (basename file)) + recursive? "sha256" file))) + (define* (package-file package #:optional file #:key (system (%current-system)) (output "out")) diff --git a/tests/monads.scm b/tests/monads.scm index ac19d33f93..ea3e4006ab 100644 --- a/tests/monads.scm +++ b/tests/monads.scm @@ -108,6 +108,16 @@ (define (g x) guile))) #:guile-for-build (package-derivation %store %bootstrap-guile))) +(test-assert "interned-file" + (run-with-store %store + (mlet* %store-monad ((file -> (search-path %load-path "guix.scm")) + (a (interned-file file)) + (b (interned-file file "b"))) + (return (equal? (call-with-input-file file get-string-all) + (call-with-input-file a get-string-all) + (call-with-input-file b get-string-all)))) + #:guile-for-build (package-derivation %store %bootstrap-guile))) + (define derivation-expression (@@ (guix monads) derivation-expression)) -- cgit v1.2.3 From 1dac85663858c8323a0d2483fb675aa5820d4d0e Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 24 Jul 2014 22:45:24 +0200 Subject: install: Add a configuration template to the image. * gnu/system/os-config.tmpl: New file. * gnu-system.am (GNU_SYSTEM_MODULES): Add it * gnu/system/install.scm (configuration-template-service): New procedure. (installation-services): Call it. * doc/guix.texi (System Installation): Mention configuration-template.scm, and @include gnu/system/os-config.tmpl. --- doc/guix.texi | 19 +++---------------- gnu-system.am | 1 + gnu/system/install.scm | 24 ++++++++++++++++++++++++ gnu/system/os-config.tmpl | 31 +++++++++++++++++++++++++++++++ 4 files changed, 59 insertions(+), 16 deletions(-) create mode 100644 gnu/system/os-config.tmpl (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index c504a5d0ba..69bae80834 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2850,24 +2850,11 @@ It is better to store that file on the target root file system, say, as @file{/mnt/etc/config.scm}. A minimal operating system configuration, with just the bare minimum and -only a root account would look like this: +only a root account would look like this (on the installation system, +this example is available as @file{/etc/configuration-template.scm}): @example -(use-modules (gnu)) - -(operating-system - (host-name "foo") - (timezone "Europe/Paris") - (locale "en_US.UTF-8") - - ;; Assuming /dev/sdX is the target hard disk, and /dev/sdX1 the - ;; target root file system. - (bootloader (grub-configuration (device "/dev/sdX"))) - (file-systems (cons (file-system - (device "/dev/sdX1") - (mount-point "/") - (type "ext4")) - %base-file-systems))) +@include gnu/system/os-config.tmpl @end example @noindent diff --git a/gnu-system.am b/gnu-system.am index c3e1b98c03..6e1e8afec0 100644 --- a/gnu-system.am +++ b/gnu-system.am @@ -268,6 +268,7 @@ GNU_SYSTEM_MODULES = \ gnu/system/file-systems.scm \ gnu/system/grub.scm \ gnu/system/install.scm \ + gnu/system/os-config.tmpl \ gnu/system/linux.scm \ gnu/system/linux-initrd.scm \ gnu/system/shadow.scm \ diff --git a/gnu/system/install.scm b/gnu/system/install.scm index d3539b3f84..567934e4c1 100644 --- a/gnu/system/install.scm +++ b/gnu/system/install.scm @@ -115,6 +115,27 @@ (define (cow-store-service) (delete-file-recursively (string-append target #$%backing-directory)))))))) +(define (configuration-template-service) + "Return a dummy service whose purpose is to install an operating system +configuration template file in the installation system." + + (define local-template + "/etc/configuration-template.scm") + (define template + (search-path %load-path "gnu/system/os-config.tmpl")) + + (mlet %store-monad ((template (interned-file template))) + (return (service + (requirement '(root-file-system)) + (provision '(os-config-template)) + (documentation + "This dummy service installs an OS configuration template.") + (start #~(const #t)) + (stop #~(const #f)) + (activate + #~(unless (file-exists? #$local-template) + (copy-file #$template #$local-template))))))) + (define (installation-services) "Return the list services for the installation image." (let ((motd (text-file "motd" " @@ -144,6 +165,9 @@ (define (normal-tty tty) #:auto-login "guest" #:login-program (log-to-info)) + ;; Documentation add-on. + (configuration-template-service) + ;; A bunch of 'root' ttys. (normal-tty "tty3") (normal-tty "tty4") diff --git a/gnu/system/os-config.tmpl b/gnu/system/os-config.tmpl new file mode 100644 index 0000000000..ad58606f67 --- /dev/null +++ b/gnu/system/os-config.tmpl @@ -0,0 +1,31 @@ +;; This is an operating system configuration template. + +(use-modules (gnu)) + +(operating-system + (host-name "antelope") + (timezone "Europe/Paris") + (locale "en_US.UTF-8") + + ;; Assuming /dev/sdX is the target hard disk, and "root" is + ;; the label of the target root file system. + (bootloader (grub-configuration (device "/dev/sdX"))) + (file-systems (cons (file-system + (device "root") + (title 'label) + (mount-point "/") + (type "ext4")) + %base-file-systems)) + + ;; This is where user accounts are specified. The "root" + ;; account is implicit, and is initially created with the + ;; empty password. + (users (list (user-account + (name "alice") + (comment "Bob's sister") + (group "users") + + ;; Adding the account to the "wheel" group + ;; makes it a sudoer. + (supplementary-groups '("wheel")) + (home-directory "/home/alice"))))) -- cgit v1.2.3 From 054e85761fc0743ebe957f759f3e6b46739d5a68 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 24 Jul 2014 23:07:53 +0200 Subject: doc: Add "guix system" to 'dir'. * doc/guix.texi: Add "guix system" to the dir entry. --- doc/guix.texi | 2 ++ 1 file changed, 2 insertions(+) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 69bae80834..6b9e87018f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -29,6 +29,8 @@ Documentation License''. Managing packages with Guix. * guix build: (guix)Invoking guix build Building packages with Guix. +* guix system: (guix)Invoking guix system + Managing the operating system configuration. @end direntry @titlepage -- cgit v1.2.3 From 931c132a58d86287d7a73964f9731a3b578538cc Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Thu, 24 Jul 2014 23:38:39 +0200 Subject: doc: Make sure out-of-source-tree builds find os-config.tmpl. * Makefile.am (BUILT_SOURCES): New variable. * daemon.am (BUILT_SOURCES): Use +=. * doc.am (BUILT_SOURCES, MAINTAINERCLEANFILES, EXTRA_DIST): Add doc/os-config.texi. (doc/os-config.texi): New target. * doc/guix.texi (System Installation): Include os-config.texi. --- Makefile.am | 1 + daemon.am | 2 +- doc.am | 11 ++++++++++- doc/guix.texi | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) (limited to 'doc/guix.texi') diff --git a/Makefile.am b/Makefile.am index 41e0e67120..ed11bcc7ac 100644 --- a/Makefile.am +++ b/Makefile.am @@ -253,6 +253,7 @@ guix_install_go_files = install-nobase_nodist_guilemoduleDATA $(guix_install_go_files): install-nobase_dist_guilemoduleDATA SUBDIRS = po/guix po/packages +BUILT_SOURCES = include doc.am diff --git a/daemon.am b/daemon.am index b0a6d48873..fb662b1b14 100644 --- a/daemon.am +++ b/daemon.am @@ -20,7 +20,7 @@ # Integration of the `guix-daemon' code taken from upstream Nix. # -BUILT_SOURCES = nix/libstore/schema.sql.hh +BUILT_SOURCES += nix/libstore/schema.sql.hh CLEANFILES += $(BUILT_SOURCES) noinst_LIBRARIES = libformat.a libutil.a libstore.a diff --git a/doc.am b/doc.am index 6cbc35a8cc..67cd739fae 100644 --- a/doc.am +++ b/doc.am @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2012, 2013 Ludovic Courtès +# Copyright © 2012, 2013, 2014 Ludovic Courtès # Copyright © 2013 Andreas Enge # # This file is part of GNU Guix. @@ -24,6 +24,15 @@ EXTRA_DIST += \ doc/images/bootstrap-graph.eps \ doc/images/bootstrap-graph.pdf +# Bundle this file so that makeinfo finds it in out-of-source-tree builds. +BUILT_SOURCES += doc/os-config.texi +EXTRA_DIST += doc/os-config.texi +MAINTAINERCLEANFILES = doc/os-config.texi + +doc/os-config.texi: gnu/system/os-config.tmpl + $(MKDIR_P) "`dirname "$@"`" + cp "$<" "$@" + infoimagedir = $(infodir)/images dist_infoimage_DATA = doc/images/bootstrap-graph.png diff --git a/doc/guix.texi b/doc/guix.texi index 6b9e87018f..2060da9c55 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2856,7 +2856,7 @@ only a root account would look like this (on the installation system, this example is available as @file{/etc/configuration-template.scm}): @example -@include gnu/system/os-config.tmpl +@include os-config.texi @end example @noindent -- cgit v1.2.3 From c8fa34265d6612c99fe80adfaa66edaddd4d5b0c Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 25 Jul 2014 00:12:35 +0200 Subject: system: Add the 'system?' field for user groups. Suggested by Mark H. Weaver. * gnu/system/shadow.scm ()[system?]: New field. (%base-groups): Introduce 'system-group' macro, and use it. * gnu/system.scm (user-group->gexp): Pass the 'system?' field. * guix/build/activation.scm (add-group): Add #:system? and honor it. (activate-users+groups): Handle the 'system?' field. * gnu/system/file-systems.scm (%tty-gid): Choose an ID below 1000. * doc/guix.texi (User Accounts): Document the 'system?' field. --- doc/guix.texi | 4 ++++ gnu/system.scm | 3 ++- gnu/system/file-systems.scm | 2 +- gnu/system/shadow.scm | 42 ++++++++++++++++++++++++------------------ guix/build/activation.scm | 9 ++++++--- 5 files changed, 37 insertions(+), 23 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index 2060da9c55..cef2aba9a8 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -3201,6 +3201,10 @@ The group's name. The group identifier (a number). If @code{#f}, a new number is automatically allocated when the group is created. +@item @code{system?} (default: @code{#f}) +This Boolean value indicates whether the group is a ``system'' group. +System groups have low numerical IDs. + @item @code{password} (default: @code{#f}) What, user groups can have a password? Well, apparently yes. Unless @code{#f}, this field specifies the group's password. diff --git a/gnu/system.scm b/gnu/system.scm index 4648d810a3..68f9438693 100644 --- a/gnu/system.scm +++ b/gnu/system.scm @@ -363,7 +363,8 @@ (define (user-group->gexp group) 'active-groups'." #~(list #$(user-group-name group) #$(user-group-password group) - #$(user-group-id group))) + #$(user-group-id group) + #$(user-group-system? group))) (define (user-account->gexp account) "Turn ACCOUNT, a object, into a list-valued gexp suitable for diff --git a/gnu/system/file-systems.scm b/gnu/system/file-systems.scm index 3b13d820cf..48c4fc7e77 100644 --- a/gnu/system/file-systems.scm +++ b/gnu/system/file-systems.scm @@ -95,7 +95,7 @@ (define %devtmpfs-file-system (define %tty-gid ;; ID of the 'tty' group. Allocate it statically to make it easy to refer ;; to it from here and from the 'tty' group definitions. - 1004) + 996) (define %pseudo-terminal-file-system ;; The pseudo-terminal file system. It needs to be mounted so that diff --git a/gnu/system/shadow.scm b/gnu/system/shadow.scm index e29dbb8c3e..5d638398d1 100644 --- a/gnu/system/shadow.scm +++ b/gnu/system/shadow.scm @@ -43,6 +43,7 @@ (define-module (gnu system shadow) user-group-name user-group-password user-group-id + user-group-system? default-skeletons skeleton-directory @@ -75,28 +76,33 @@ (define-record-type* user-group? (name user-group-name) (password user-group-password (default #f)) - (id user-group-id (default #f))) + (id user-group-id (default #f)) + (system? user-group-system? ; Boolean + (default #f))) (define %base-groups ;; Default set of groups. - (list (user-group (name "root") (id 0)) - (user-group (name "wheel")) ; root-like users - (user-group (name "users")) ; normal users - (user-group (name "nogroup")) ; for daemons etc. + (let-syntax ((system-group (syntax-rules () + ((_ args ...) + (user-group (system? #t) args ...))))) + (list (system-group (name "root") (id 0)) + (system-group (name "wheel")) ; root-like users + (system-group (name "users")) ; normal users + (system-group (name "nogroup")) ; for daemons etc. - ;; The following groups are conventionally used by things like udev to - ;; control access to hardware devices. - (user-group (name "tty") (id %tty-gid)) - (user-group (name "dialout")) - (user-group (name "kmem")) - (user-group (name "video")) - (user-group (name "audio")) - (user-group (name "netdev")) ; used in avahi-dbus.conf - (user-group (name "lp")) - (user-group (name "disk")) - (user-group (name "floppy")) - (user-group (name "cdrom")) - (user-group (name "tape")))) + ;; The following groups are conventionally used by things like udev to + ;; control access to hardware devices. + (system-group (name "tty") (id %tty-gid)) + (system-group (name "dialout")) + (system-group (name "kmem")) + (system-group (name "video")) + (system-group (name "audio")) + (system-group (name "netdev")) ; used in avahi-dbus.conf + (system-group (name "lp")) + (system-group (name "disk")) + (system-group (name "floppy")) + (system-group (name "cdrom")) + (system-group (name "tape"))))) (define (default-skeletons) "Return the default skeleton files for /etc/skel. These files are copied by diff --git a/guix/build/activation.scm b/guix/build/activation.scm index 9464d2157d..b04b017881 100644 --- a/guix/build/activation.scm +++ b/guix/build/activation.scm @@ -36,13 +36,14 @@ (define-module (guix build activation) ;;; ;;; Code: -(define* (add-group name #:key gid password +(define* (add-group name #:key gid password system? (log-port (current-error-port))) "Add NAME as a user group, with the given numeric GID if specified." ;; Use 'groupadd' from the Shadow package. (format log-port "adding group '~a'...~%" name) (let ((args `(,@(if gid `("-g" ,(number->string gid)) '()) ,@(if password `("-p" ,password) '()) + ,@(if system? `("--system") '()) ,name))) (zero? (apply system* "groupadd" args)))) @@ -128,9 +129,11 @@ (define activate-user ;; Then create the groups. (for-each (match-lambda - ((name password gid) + ((name password gid system?) (unless (false-if-exception (getgrnam name)) - (add-group name #:gid gid #:password password)))) + (add-group name + #:gid gid #:password password + #:system? system?)))) groups) ;; Finally create the other user accounts. -- cgit v1.2.3 From 445d652916b4ffe337b2d1c7bfd2df70b925f486 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 25 Jul 2014 13:35:12 +0200 Subject: doc: Fix typo in USB image file name. * doc/guix.texi (System Installation): Change image file 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 cef2aba9a8..b1c0a4961c 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -2783,7 +2783,7 @@ its device name. Assuming that USB stick is known as @file{/dev/sdX}, copy the image with: @example -dd if=gnu-usb-install-20140629.x86_64 of=/dev/sdX +dd if=gnu-usb-install-@value{VERSION}.x86_64 of=/dev/sdX @end example Access to @file{/dev/sdX} usually requires root privileges. -- cgit v1.2.3 From 6621cdb65c09e8e7b428ccbc8d02e084420dde52 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 25 Jul 2014 22:05:17 +0200 Subject: doc: Replace incorrect uses of @ref by @pxref. * doc/guix.texi: Use @pxref at the end of sentences, not @ref. --- doc/guix.texi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'doc/guix.texi') diff --git a/doc/guix.texi b/doc/guix.texi index b1c0a4961c..b0f4e1ad81 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -131,7 +131,7 @@ ready to use it. Note that this section is concerned with the installation of the package manager, which can be done on top of a running GNU/Linux system. If, instead, you want to install the complete GNU operating system, -@ref{System Installation}. +@pxref{System Installation}. The build procedure for Guix is the same as for other GNU software, and is not covered here. Please see the files @file{README} and @@ -1818,7 +1818,7 @@ As can be guessed, this primitive is cumbersome to use directly. A better approach is to write build scripts in Scheme, of course! The best course of action for that is to write the build code as a ``G-expression'', and to pass it to @code{gexp->derivation}. For more -information, @ref{G-Expressions}. +information, @pxref{G-Expressions}. Once upon a time, @code{gexp->derivation} did not exist and constructing derivations with build code written in Scheme was achieved with @@ -2696,14 +2696,14 @@ to join! @ref{Contributing}, for information about how you can help. This section explains how to install the complete GNU operating system on a machine. The Guix package manager can also be installed on top of -a running GNU/Linux system, @ref{Installation}. +a running GNU/Linux system, @pxref{Installation}. @ifinfo @c This paragraph is for people reading this from tty2 of the @c installation image. You're reading this documentation with an Info reader. For details on how to use it, hit the @key{RET} key (``return'' or ``enter'') on the -link that follows: @ref{Help,,, info, Info: An Introduction}. Hit +link that follows: @pxref{Help,,, info, Info: An Introduction}. Hit @kbd{l} afterwards to come back here. @end ifinfo @@ -2861,7 +2861,7 @@ this example is available as @file{/etc/configuration-template.scm}): @noindent For more information on @code{operating-system} declarations, -@xref{Using the Configuration System}. +@pxref{Using the Configuration System}. Once that is done, the new system must be initialized (remember that the target root file system is mounted under @file{/mnt}): @@ -2873,7 +2873,7 @@ guix system init /mnt/etc/config.scm /mnt @noindent This will copy all the necessary files, and install GRUB on @file{/dev/sdX}, unless you pass the @option{--no-grub} option. For -more information, @xref{Invoking guix system}. This command may trigger +more information, @pxref{Invoking guix system}. This command may trigger downloads or builds of missing packages, which can take some time. Once that command has completed---and hopefully succeeded!---you can -- cgit v1.2.3