From d48d464c8b864e0149fb8cff2634aa2d61e7e109 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Jan 2025 15:03:46 +0100 Subject: [PATCH] Add a test for #12339 --- tests/functional/nix-channel.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tests/functional/nix-channel.sh b/tests/functional/nix-channel.sh index 16d6a1355..d0b772850 100755 --- a/tests/functional/nix-channel.sh +++ b/tests/functional/nix-channel.sh @@ -68,4 +68,14 @@ nix-env -i dependencies-top [ -e $TEST_HOME/.nix-profile/foobar ] # Test evaluation through a channel symlink (#9882). -nix-instantiate '' +drvPath=$(nix-instantiate '') + +# Add a test for the special case behaviour of 'nixpkgs' in the +# channels for root (see EvalSettings::getDefaultNixPath()). +if ! isTestOnNixOS; then + nix-channel --add file://$TEST_ROOT/foo nixpkgs + nix-channel --update + mv $TEST_HOME/.local/state/nix/profiles $TEST_ROOT/var/nix/profiles/per-user/root + drvPath2=$(nix-instantiate '') + [[ "$drvPath" = "$drvPath2" ]] +fi