Skip to content

Commit

Permalink
Test that the root of a tree produces /nix/store/<hash1>-<hash2>-source
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Apr 30, 2024
1 parent e18c3d4 commit 5739825
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tests/functional/flakes/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ writeSimpleFlake() {
parent = builtins.dirOf ./.;
baseName = builtins.baseNameOf ./.;
root = ./.;
};
}
EOF
Expand Down
5 changes: 4 additions & 1 deletion tests/functional/flakes/flakes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/<hash1>-<hash2>-source.
[[ $(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)
Expand Down

0 comments on commit 5739825

Please sign in to comment.