aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars-Dominik Braun <ldb@leibniz-psychology.org>2020-08-25 10:52:21 +0200
committerLudovic Courtès <ludo@gnu.org>2020-08-30 23:51:03 +0200
commitbc8be17c4dd1e7bb8eb98a0b7e5bcb0a536719b0 (patch)
tree5b307701296660a4d8c79a3f29f546b5bc7b9da2
parent769b948f7fe9565ad6dfac112fe233a134de049e (diff)
downloadguix-bc8be17c4dd1e7bb8eb98a0b7e5bcb0a536719b0.tar
guix-bc8be17c4dd1e7bb8eb98a0b7e5bcb0a536719b0.tar.gz
environment: Set USER and LOGNAME in container
* guix/scripts/environment.scm (launch-environment/container): Set username environment variables. Signed-off-by: Ludovic Courtès <ludo@gnu.org>
-rw-r--r--guix/scripts/environment.scm5
1 files changed, 5 insertions, 0 deletions
diff --git a/guix/scripts/environment.scm b/guix/scripts/environment.scm
index b8979cac19..1fb3505307 100644
--- a/guix/scripts/environment.scm
+++ b/guix/scripts/environment.scm
@@ -477,6 +477,7 @@ WHILE-LIST."
(group-entry (gid 65534) ;the overflow GID
(name "overflow"))))
(home-dir (password-entry-directory passwd))
+ (logname (password-entry-name passwd))
(environ (filter (match-lambda
((variable . value)
(find (cut regexp-exec <> variable)
@@ -528,6 +529,10 @@ WHILE-LIST."
;; The same variables as in Nix's 'build.cc'.
'("TMPDIR" "TEMPDIR" "TMP" "TEMP"))
+ ;; Some programs expect USER and/or LOGNAME to be set.
+ (setenv "LOGNAME" logname)
+ (setenv "USER" logname)
+
;; Create a dummy home directory.
(mkdir-p home-dir)
(setenv "HOME" home-dir)