nixos/system-environment: fix syntax for environment variables

`@` synax is for `PAM_ITEM`s, `HOME` needs to use `$`.
This commit is contained in:
Michael Peyton Jones 2019-09-30 21:01:33 +01:00 committed by worldofpeace
parent 9d61ddaf82
commit d8b9742deb

View file

@ -78,7 +78,9 @@ in
# We're trying to use the same syntax for PAM variables and env variables.
# That means we need to map the env variables that people might use to their
# equivalent PAM variable.
replaceEnvVars = replaceStrings ["$HOME" "$USER"] ["@{HOME}" "@{PAM_USER}"]
# Note: PAM_USER is a PAM_ITEM, HOME is an environment variable, they have
# different syntax.
replaceEnvVars = replaceStrings ["$HOME" "$USER"] ["\${HOME}" "@{PAM_USER}"];
pamVariable = n: v:
''${n} DEFAULT="${concatStringsSep ":" (map replaceEnvVars (toList v))}"'';