aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-06-21 14:37:25 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-06-21 14:37:25 +0200
commit29c2dfd0a96606cef26ae149c56d33924cf2df63 (patch)
treea4983ba38a8ee3c979e8ef6c48acc79e3112c611
parent29ccb2e9697ee2184012dd13854e487928ae4441 (diff)
parente3552f2bcf246ea8f0dae0c076f1f67e86953746 (diff)
Merge branch 'cli-tests' of https://github.com/CSVdB/nix into flakes
-rw-r--r--tests/flakes.sh24
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