environment: Make home writable.

Fixes <https://issues.guix.gnu.org/78363>.

* guix/scripts/environment.scm (launch-environment/container): Add tmpfs for
home.
* tests/guix-environment-container.sh: Add test.

Change-Id: Iadd9b838f6442a8080998ed7e07414db562068bf
Signed-off-by: Ludovic Courtès <ludo@gnu.org>
This commit is contained in:
Tomas Volf 2025-05-18 15:39:36 +02:00 committed by Ludovic Courtès
parent 7a888d9841
commit 11e88de060
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5
2 changed files with 12 additions and 1 deletions

View file

@ -874,7 +874,14 @@ WHILE-LIST."
(writable? #f)))
reqs)))
(file-systems (append %container-file-systems
(list tmpfs)
(list tmpfs ; RW /tmp
(file-system ; RW ~
(device "none")
(mount-point
(or (and=> user user-override-home)
home))
(type "tmpfs")
(check? #f)))
(if network?
(filter-map optional-mapping->fs
%network-file-mappings)

View file

@ -199,6 +199,10 @@ guix environment --bootstrap --container --ad-hoc guile-bootstrap \
guix environment --bootstrap --container --ad-hoc guile-bootstrap \
-- guile -c '(mkdir "/tmp/foo")'
# And so is ~.
guix environment --bootstrap --container --ad-hoc guile-bootstrap \
-- guile -c '(mkdir (string-append (getenv "HOME") "/foo"))'
# Check the exit code.