aboutsummaryrefslogtreecommitdiff
path: root/tests/flakes
diff options
context:
space:
mode:
Diffstat (limited to 'tests/flakes')
-rw-r--r--tests/flakes/flakes.sh20
1 files changed, 19 insertions, 1 deletions
diff --git a/tests/flakes/flakes.sh b/tests/flakes/flakes.sh
index 8cdc320fb..07f1e6698 100644
--- a/tests/flakes/flakes.sh
+++ b/tests/flakes/flakes.sh
@@ -74,8 +74,10 @@ nix registry add --registry $registry flake3 git+file://$flake3Dir
nix registry add --registry $registry flake4 flake3
nix registry add --registry $registry nixpkgs flake1
-# Test 'nix flake list'.
+# Test 'nix registry list'.
[[ $(nix registry list | wc -l) == 5 ]]
+nix registry list | grep -q '^global'
+nix registry list | grep -q -v '^user' # nothing in user registry
# Test 'nix flake metadata'.
nix flake metadata flake1
@@ -340,6 +342,16 @@ nix registry pin flake1 flake3
nix registry remove flake1
[[ $(nix registry list | wc -l) == 5 ]]
+# Test 'nix registry list' with a disabled global registry.
+nix registry add user-flake1 git+file://$flake1Dir
+nix registry add user-flake2 git+file://$flake2Dir
+[[ $(nix --flake-registry "" registry list | wc -l) == 2 ]]
+nix --flake-registry "" registry list | grep -q -v '^global' # nothing in global registry
+nix --flake-registry "" registry list | grep -q '^user'
+nix registry remove user-flake1
+nix registry remove user-flake2
+[[ $(nix registry list | wc -l) == 5 ]]
+
# Test 'nix flake clone'.
rm -rf $TEST_ROOT/flake1-v2
nix flake clone flake1 --dest $TEST_ROOT/flake1-v2
@@ -473,3 +485,9 @@ nix store delete $(nix store add-path $badFlakeDir)
[[ $(nix path-info $(nix store add-path $flake1Dir)) =~ flake1 ]]
[[ $(nix path-info path:$(nix store add-path $flake1Dir)) =~ simple ]]
+
+# Test fetching flakerefs in the legacy CLI.
+[[ $(nix-instantiate --eval flake:flake3 -A x) = 123 ]]
+[[ $(nix-instantiate --eval flake:git+file://$flake3Dir -A x) = 123 ]]
+[[ $(nix-instantiate -I flake3=flake:flake3 --eval '<flake3>' -A x) = 123 ]]
+[[ $(NIX_PATH=flake3=flake:flake3 nix-instantiate --eval '<flake3>' -A x) = 123 ]]