diff options
author | Nick Van den Broeck <nick.van.den.broeck666@gmail.com> | 2019-06-19 14:48:40 +0200 |
---|---|---|
committer | Nick Van den Broeck <nick.van.den.broeck666@gmail.com> | 2019-06-19 17:15:58 +0200 |
commit | e3552f2bcf246ea8f0dae0c076f1f67e86953746 (patch) | |
tree | 47ad4e913955f269ccbed2b999422c694a772e5a /tests/flakes.sh | |
parent | e75ffbf04abb39e7835d3ab3150065a1581d2388 (diff) |
Added tests for the `nix flake` CLI
Diffstat (limited to 'tests/flakes.sh')
-rw-r--r-- | tests/flakes.sh | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/flakes.sh b/tests/flakes.sh index 85ba7c8c9..0571c2a62 100644 --- a/tests/flakes.sh +++ b/tests/flakes.sh @@ -16,9 +16,10 @@ flake1Dir=$TEST_ROOT/flake1 flake2Dir=$TEST_ROOT/flake2 flake3Dir=$TEST_ROOT/flake3 flake4Dir=$TEST_ROOT/flake4 +flake7Dir=$TEST_ROOT/flake7 nonFlakeDir=$TEST_ROOT/nonFlake -for repo in $flake1Dir $flake2Dir $flake3Dir $nonFlakeDir; do +for repo in $flake1Dir $flake2Dir $flake3Dir $flake7Dir $nonFlakeDir; do rm -rf $repo $repo.tmp mkdir $repo git -C $repo init @@ -76,6 +77,10 @@ cat > $flake3Dir/flake.nix <<EOF outputs = inputs: rec { packages.xyzzy = inputs.flake2.packages.bar; + + checks = { + xyzzy = packages.xyzzy; + }; }; } EOF @@ -159,6 +164,10 @@ git -C $flake2Dir commit flake.lock -m 'Add flake.lock' nix build -o $TEST_ROOT/result --flake-registry $registry $flake2Dir:bar [[ -z $(git -C $flake2Dir diff master) ]] +# Updating the flake should not change the lockfile. +nix flake update --flake-registry $registry $flake2Dir +[[ -z $(git -C $flake2Dir diff master) ]] + # Now we should be able to build the flake in pure mode. nix build -o $TEST_ROOT/result --flake-registry $registry flake2:bar @@ -328,3 +337,16 @@ git -C $flake3Dir checkout master # Test whether fuzzy-matching works for IsGit (! nix build -o $TEST_ROOT/result --flake-registry $registry flake4/removeXyzzy:xyzzy) nix build -o $TEST_ROOT/result --flake-registry $registry flake4/removeXyzzy:sth + +# Testing the nix CLI +nix flake add --flake-registry $registry flake1 flake3 +(( $(nix flake list --flake-registry $registry | wc -l) == 7 )) +nix flake pin --flake-registry $registry flake1 +(( $(nix flake list --flake-registry $registry | wc -l) == 7 )) +nix flake remove --flake-registry $registry flake1 +(( $(nix flake list --flake-registry $registry | wc -l) == 6 )) + +(cd $flake7Dir && nix flake init) +nix flake --flake-registry $registry check $flake3Dir + +nix flake clone --flake-registry $registry flake1 $TEST_ROOT/flake1-v2 |