summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosselin Poiret <dev@jpoiret.xyz>2023-02-13 22:31:21 +0100
committerMaxim Cournoyer <maxim.cournoyer@gmail.com>2023-03-06 21:18:57 -0500
commitaca64d560452812208c654abba1ec3ab7041eefd (patch)
treeed20448b50d050349bd1840b4d45424ddfd520c3
parent61a0b03c65bd9b1056075d1f78487d2259526a07 (diff)
downloadguix-aca64d560452812208c654abba1ec3ab7041eefd.tar.gz
scripts: environment: Fix ordering issue with CWD and --expose.
Fixes <https://issues.guix.gnu.org/46782>.

* guix/scripts/environment.scm (launch-environment/container): Move the CWD
mapping to the front of the file system mappings.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
-rw-r--r--guix/scripts/environment.scm19
1 files changed, 11 insertions, 8 deletions
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index 44cfcb4f76..33a76abff3 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -767,14 +767,17 @@ WHILE-LIST."
              (append
               (override-user-mappings
                user home
-               (append user-mappings
-                       ;; Share current working directory, unless asked not to.
-                       (if map-cwd?
-                           (list (file-system-mapping
-                                  (source cwd)
-                                  (target cwd)
-                                  (writable? #t)))
-                           '())))
+               (append
+                ;; Share current working directory, unless asked not to.
+                (if map-cwd?
+                    (list (file-system-mapping
+                           (source cwd)
+                           (target cwd)
+                           (writable? #t)))
+                    '())
+                ;; Add the user mappings *after* the current working directory
+                ;; so that a user can layer bind mounts on top of it.
+                user-mappings))
               ;; Mappings for the union closure of all inputs.
               (map (lambda (dir)
                      (file-system-mapping