aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-06-04 20:56:13 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-06-04 20:56:42 +0200
commit1e53a07712fba830eb3967cc16894992d5a33922 (patch)
tree419c034629eb0b1ce3fc28ffe9cccdcaf9062866 /tests
parent1c5067b9a7e1f561bf9e9e84642c495a50ca44a7 (diff)
Make non-flake inputs lazy
Also add a proper test for non-flake inputs.
Diffstat (limited to 'tests')
-rw-r--r--tests/flakes.sh25
1 files changed, 22 insertions, 3 deletions
diff --git a/tests/flakes.sh b/tests/flakes.sh
index f9f8e5272..1cd8259b9 100644
--- a/tests/flakes.sh
+++ b/tests/flakes.sh
@@ -83,7 +83,7 @@ git -C $flake3Dir add flake.nix
git -C $flake3Dir commit -m 'Initial'
cat > $nonFlakeDir/README.md <<EOF
-Not much
+FNORD
EOF
git -C $nonFlakeDir add README.md
@@ -235,23 +235,42 @@ cat > $flake3Dir/flake.nix <<EOF
outputs = inputs: rec {
packages.xyzzy = inputs.flake2.outputs.packages.bar;
packages.sth = inputs.flake1.outputs.packages.foo;
+ packages.fnord =
+ with import ./config.nix;
+ mkDerivation {
+ inherit system;
+ name = "fnord";
+ buildCommand = ''
+ cat \${inputs.nonFlake}/README.md > \$out
+ '';
+ };
};
}
EOF
-git -C $flake3Dir add flake.nix
+cp ./config.nix $flake3Dir
+
+git -C $flake3Dir add flake.nix config.nix
git -C $flake3Dir commit -m 'Add nonFlakeInputs'
-# Check whether `nix build` works with a lockfile which is missing a nonFlakeInputs
+# Check whether `nix build` works with a lockfile which is missing a
+# nonFlakeInputs.
nix build -o $TEST_ROOT/result --flake-registry $registry $flake3Dir:sth
git -C $flake3Dir commit -m 'Update nonFlakeInputs'
+nix build -o $TEST_ROOT/result --flake-registry $registry flake3:fnord
+[[ $(cat $TEST_ROOT/result) = FNORD ]]
+
# Check whether flake input fetching is lazy: flake3:sth does not
# depend on flake2, so this shouldn't fail.
rm -rf $TEST_HOME/.cache
clearStore
mv $flake2Dir $flake2Dir.tmp
+mv $nonFlakeDir $nonFlakeDir.tmp
nix build -o $TEST_ROOT/result --flake-registry $registry flake3:sth
(! nix build -o $TEST_ROOT/result --flake-registry $registry flake3:xyzzy)
+(! nix build -o $TEST_ROOT/result --flake-registry $registry flake3:fnord)
mv $flake2Dir.tmp $flake2Dir
+mv $nonFlakeDir.tmp $nonFlakeDir
+nix build -o $TEST_ROOT/result --flake-registry $registry flake3:xyzzy flake3:fnord