Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert to manual quoting to make sure env variables can be used as part of other env variables when prefixing #264

Merged
merged 2 commits into from
Jul 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/env.nix
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ let
else if valType == "eval" then
"export ${name}=${eval}"
else if valType == "prefix" then
''export ${name}=$(${pkgs.coreutils}/bin/realpath --canonicalize-missing ${escapeShellArg prefix})''${${name}+:''${${name}}}''
''export ${name}=$(${pkgs.coreutils}/bin/realpath --canonicalize-missing "${prefix}")''${${name}+:''${${name}}}''
else if valType == "unset" then
''unset ${name}''
else
Expand Down
16 changes: 16 additions & 0 deletions tests/extra/language.c.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,20 @@
# Has a C compiler
type -p clang
'';
# Test good LD_LIBRARY_PATH value
language-c-2 =
let
shell = devshell.mkShell {
imports = [ ../../extra/language/c.nix ];
devshell.name = "devshell-2";
language.c.libraries = [ pkgs.openssl ];
};
in
runTest "language-c-2" { } ''
# Load the devshell
source ${shell}/env.bash

# LD_LIBRARY_PATH is evaluated correctly
[[ ! "$LD_LIBRARY_PATH" =~ "DEVSHELL_DIR" ]]
'';
}