From f29a220b7092954644884d193aea13531f77b69b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 30 Apr 2024 16:46:36 +0200 Subject: [PATCH 1/2] Test that the root of a tree produces /nix/store/--source --- tests/functional/flakes/common.sh | 2 ++ tests/functional/flakes/flakes.sh | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/functional/flakes/common.sh b/tests/functional/flakes/common.sh index e0776d5ed..f83a02aba 100644 --- a/tests/functional/flakes/common.sh +++ b/tests/functional/flakes/common.sh @@ -25,6 +25,8 @@ writeSimpleFlake() { parent = builtins.dirOf ./.; baseName = builtins.baseNameOf ./.; + + root = ./.; }; } EOF diff --git a/tests/functional/flakes/flakes.sh b/tests/functional/flakes/flakes.sh index b2bea0711..a74d56a5b 100644 --- a/tests/functional/flakes/flakes.sh +++ b/tests/functional/flakes/flakes.sh @@ -235,7 +235,10 @@ nix build -o "$TEST_ROOT/result" --expr "(builtins.getFlake \"git+file://$flake1 [[ $(nix eval --json flake1#parent) = \""$NIX_STORE_DIR"\" ]] # Regression test for baseNameOf on the root of the flake. -[[ $(nix eval --raw flake1#baseName) =~ ^[a-z0-9]*-source$ ]] +[[ $(nix eval --raw flake1#baseName) =~ ^[a-z0-9]+-source$ ]] + +# Test that the root of a tree returns a path named /nix/store/--source (#10627). +[[ $(nix eval --raw flake1#root) =~ ^.*/[a-z0-9]+-[a-z0-9]+-source$ ]] # Building a flake with an unlocked dependency should fail in pure mode. (! nix build -o "$TEST_ROOT/result" flake2#bar --no-registries) From 1f4168221757f46d57f951692158138dbb4059b0 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 30 Apr 2024 18:10:16 +0200 Subject: [PATCH 2/2] Update tests/functional/flakes/flakes.sh Co-authored-by: John Ericson --- tests/functional/flakes/flakes.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/functional/flakes/flakes.sh b/tests/functional/flakes/flakes.sh index a74d56a5b..35b0c5d84 100644 --- a/tests/functional/flakes/flakes.sh +++ b/tests/functional/flakes/flakes.sh @@ -237,7 +237,9 @@ nix build -o "$TEST_ROOT/result" --expr "(builtins.getFlake \"git+file://$flake1 # Regression test for baseNameOf on the root of the flake. [[ $(nix eval --raw flake1#baseName) =~ ^[a-z0-9]+-source$ ]] -# Test that the root of a tree returns a path named /nix/store/--source (#10627). +# Test that the root of a tree returns a path named /nix/store/--source. +# This behavior is *not* desired, but has existed for a while. +# Issue #10627 what to do about it. [[ $(nix eval --raw flake1#root) =~ ^.*/[a-z0-9]+-[a-z0-9]+-source$ ]] # Building a flake with an unlocked dependency should fail in pure mode.