Skip to content

Commit

Permalink
WIP: only test in derivations
Browse files Browse the repository at this point in the history
  • Loading branch information
fricklerhandwerk committed Sep 9, 2024
1 parent 4a920b4 commit 2754111
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions tests/functional/nix_path.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,17 @@ done
# finding something that's not in any of the default paths fails
( ! $(nix-instantiate --find-file test) )

# setting anything overrides the default paths
# this ensures we can force an empty search path
[[ $(NIX_PATH= nix-instantiate --eval -E 'with builtins; length nixPath') = 0 ]]
[[ $(nix-instantiate --nix-path "" --eval -E 'with builtins; length nixPath') = 0 ]]
[[ $(nix-instantiate -I "" --eval -E 'with builtins; length nixPath') = 1 ]]
# XXX: we can't manipulate $NIX_STATE_DIR contents on NixOS
# TODO: port to NixOS somehow; ideally we'd run the test suite in a non-NixOS VM
if [[ isTestOnNixOS ]]; then
mkdir -p $NIX_STATE_DIR/profiles/per-user/root/channels/nixpkgs
[[ $(nix-instantiate --eval -E 'with builtins; length nixPath') = 2 ]]
# setting anything overrides the default paths
# this ensures we can force an empty search path
[[ $(NIX_PATH= nix-instantiate --eval -E 'with builtins; length nixPath') = 0 ]]
[[ $(nix-instantiate --nix-path "" --eval -E 'with builtins; length nixPath') = 0 ]]
[[ $(nix-instantiate -I "" --eval -E 'with builtins; length nixPath') = 1 ]]
fi

echo "nix-path = test=$TEST_ROOT/from-nix-path-file" >> "$test_nix_conf"

Expand Down

0 comments on commit 2754111

Please sign in to comment.