test_gc: force change of env by passing arg to shell.nix

This commit is contained in:
Quentin Aristote 2022-10-21 12:18:32 +02:00
parent 64c2b7bff7
commit db0e37ea65
2 changed files with 7 additions and 12 deletions

View file

@ -64,8 +64,7 @@ def test_use_nix(direnv_project: DirenvProject) -> None:
direnv_project.setup_envrc("use nix")
common_test(direnv_project)
# --pure here is just a way to make sure the environment changes
direnv_project.setup_envrc("use nix --pure")
direnv_project.setup_envrc("use nix --argstr 'echo Executing hijacked shellHook.'")
common_test_clean(direnv_project)
@ -81,7 +80,6 @@ def test_use_flake(direnv_project: DirenvProject) -> None:
for symlink in inputs:
assert symlink.is_dir()
# --impure here is just a way to make sure the environment changes
direnv_project.setup_envrc("use flake --impure")
common_test_clean(direnv_project)

View file

@ -1,14 +1,11 @@
{ pkgs ? import <nixpkgs> {}, someArg ? null }:
{ pkgs ? import <nixpkgs> { }, someArg ? null, shellHook ? ''
echo "Executing shellHook."
'' }:
pkgs.mkShellNoCC {
inherit shellHook;
nativeBuildInputs = [ pkgs.hello ];
shellHook = ''
echo "Executing shellHook."
'';
SHOULD_BE_SET = someArg;
passthru = {
subshell = pkgs.mkShellNoCC {
THIS_IS_A_SUBSHELL = "OK";
};
};
passthru = { subshell = pkgs.mkShellNoCC { THIS_IS_A_SUBSHELL = "OK"; }; };
}