@@ -6196,21 +6196,26 @@ directory:
guix shell --container --expose=$HOME=/exchange guile -- guile
@end example
+@cindex file system hierarchy standard (FHS)
+@cindex FHS (file system hierarchy standard)
@item --emulate-fhs
-@item -F
-For containers, emulate a Filesystem Hierarchy Standard (FHS)
-configuration within the container, see
-@uref{https://refspecs.linuxfoundation.org/fhs.shtml, the official
-specification}. As Guix deviates from the FHS specification, this
+@itemx -F
+When used with @option{--container}, emulate a
+@uref{https://refspecs.linuxfoundation.org/fhs.shtml, Filesystem
+Hierarchy Standard (FHS)} configuration within the container, providing
+@file{/bin}, @file{/lib}, and other directories and files specified by
+the FHS.
+
+As Guix deviates from the FHS specification, this
option sets up the container to more closely mimic that of other
GNU/Linux distributions. This is useful for reproducing other
development environments, testing, and using programs which expect the
FHS specification to be followed. With this option, the container will
-include a version of @code{glibc} which will read
-@code{/etc/ld.so.cache} within the container for the shared library
-cache (contrary to @code{glibc} in regular Guix usage) and set up the
-expected FHS directories: @code{/bin}, @code{/etc}, @code{/lib}, and
-@code{/usr} from the container's profile.
+include a version of glibc that will read
+@file{/etc/ld.so.cache} within the container for the shared library
+cache (contrary to glibc in regular Guix usage) and set up the
+expected FHS directories: @file{/bin}, @file{/etc}, @file{/lib}, and
+@file{/usr} from the container's profile.
@item --rebuild-cache
@cindex caching, of profiles
@@ -933,15 +933,15 @@ (define (linker-script? file)
;; in FHS containers.
(define-public glibc-for-fhs
(hidden-package
- (package
- (inherit glibc)
+ (package/inherit glibc
(name "glibc-for-fhs")
(source (origin (inherit (package-source glibc))
;; Remove Guix's patch to read ld.so.cache from /gnu/store
;; directories, re-enabling the default /etc/ld.so.cache
;; behavior.
- (patches (delete (car (search-patches "glibc-dl-cache.patch"))
- (origin-patches (package-source glibc)))))))))
+ (patches
+ (delete (search-patch "glibc-dl-cache.patch")
+ (origin-patches (package-source glibc)))))))))
;; Below are old libc versions, which we use mostly to build locale data in
;; the old format (which the new libc cannot cope with.)
@@ -475,10 +475,10 @@ (define* (launch-environment command profile manifest
(catch 'system-error
(lambda ()
(when emulate-fhs?
- ;; When running in a container with EMULATE-FHS?, supplement $PATH
+ ;; When running in a container with EMULATE-FHS?, override $PATH
;; (optional, but to better match FHS expectations), and generate
;; /etc/ld.so.cache.
- (setenv "PATH" "/bin:/usr/bin:/sbin:/usr/sbin:$PATH")
+ (setenv "PATH" "/bin:/usr/bin:/sbin:/usr/sbin")
(invoke "ldconfig" "-X"))
(apply execlp program program args))
(lambda _
@@ -687,12 +687,15 @@ (define* (launch-environment/container #:key command bash user user-mappings
list of file system mappings, contains the user-specified host file systems to
mount inside the container. If USER is not #f, each target of USER-MAPPINGS
will be re-written relative to '/home/USER', and USER will be used for the
-passwd entry. When EMULATE-FHS?, set up the container to follow the
-Filesystem Hierarchy Standard and provide a glibc that reads the cache from
-/etc/ld.so.cache. SETUP-HOOK is an additional setup procedure to be called, as a
-list with the function name and arguments, currently only used with the
-EMULATE-FHS? option. LINK-PROFILE? creates a symbolic link from
-~/.guix-profile to the environment profile.
+passwd entry.
+
+When EMULATE-FHS?, set up the container to follow the Filesystem Hierarchy
+Standard and provide a glibc that reads the cache from /etc/ld.so.cache.
+SETUP-HOOK is an additional setup procedure to be called, currently only used
+with the EMULATE-FHS? option.
+
+LINK-PROFILE? creates a symbolic link from ~/.guix-profile to the
+environment profile.
Preserve environment variables whose name matches the one of the regexps in
WHILE-LIST."
@@ -801,11 +804,9 @@ (define fhs-mappings
(mkdir-p home-dir)
(setenv "HOME" home-dir)
- ;; Call an additional setup procedure, if provided. Currently
- ;; this is only used with the EMULATE-FHS? option, but could be
- ;; expanded to a general list of functions to be called.
- (if setup-hook
- (apply (car setup-hook) (cdr setup-hook)))
+ ;; Call an additional setup procedure, if provided.
+ (when setup-hook
+ (setup-hook profile))
;; If requested, link $GUIX_ENVIRONMENT to $HOME/.guix-profile;
;; this allows programs expecting that path to continue working as
@@ -1113,9 +1114,9 @@ (define manifest
#:network? network?
#:map-cwd? (not no-cwd?)
#:emulate-fhs? emulate-fhs?
- #:setup-hook (if emulate-fhs?
- (list setup-fhs profile)
- #f))))
+ #:setup-hook
+ (and emulate-fhs?
+ setup-fhs))))
(else
(return
@@ -230,4 +230,4 @@ guix environment -C --emulate-fhs --ad-hoc --bootstrap guile-bootstrap \
# Test that the ld cache was generated and can be successfully read.
guix environment -C --emulate-fhs --ad-hoc --bootstrap guile-bootstrap \
- -- guile -c '(exit (execlp "ldconfig" "-p"))'
+ -- guile -c '(execlp "ldconfig" "ldconfig" "-p")'