1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-19 10:50:24 -04:00

WIP: only test in derivations

This commit is contained in:
Valentin Gagarin 2024-09-09 16:09:37 +02:00
parent 4a920b46da
commit 1f032a98c5

View file

@ -42,11 +42,18 @@ done
# finding something that's not in any of the default paths fails # finding something that's not in any of the default paths fails
( ! $(nix-instantiate --find-file test) ) ( ! $(nix-instantiate --find-file test) )
# 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
# check that the default values are set
[[ $(nix-instantiate --eval -E 'with builtins; length nixPath') = 2 ]]
# setting anything overrides the default paths # setting anything overrides the default paths
# this ensures we can force an empty search path # this ensures we can force an empty search path
[[ $(NIX_PATH= nix-instantiate --eval -E 'with builtins; length nixPath') = 0 ]] [[ $(NIX_PATH= nix-instantiate --eval -E 'with builtins; length nixPath') = 0 ]]
[[ $(nix-instantiate --nix-path "" --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 ]] [[ $(nix-instantiate -I "" --eval -E 'with builtins; length nixPath') = 1 ]]
fi
echo "nix-path = test=$TEST_ROOT/from-nix-path-file" >> "$test_nix_conf" echo "nix-path = test=$TEST_ROOT/from-nix-path-file" >> "$test_nix_conf"