diff --git a/tests/functional/flakes/flakes.sh b/tests/functional/flakes/flakes.sh index ea58d3b41..f5adb8d33 100644 --- a/tests/functional/flakes/flakes.sh +++ b/tests/functional/flakes/flakes.sh @@ -77,10 +77,6 @@ git -C $flake1Dir add $flake1Dir/foo echo -n '# foo' >> $flake1Dir/flake.nix git -C $flake1Dir commit -a -m 'Foo' -# Check that store symlinks inside a flake are not interpreted as flakes. -nix build -o $flake1Dir/result git+file://$flake1Dir -nix path-info $flake1Dir/result - # set up lockfiles for later tests nix build -o $TEST_ROOT/result $flake2Dir#bar --commit-lock-file nix build -o $TEST_ROOT/result $flake3Dir#xyzzy @@ -170,13 +166,3 @@ nix build -o $TEST_ROOT/result flake3#sth mv $flake2Dir.tmp $flake2Dir mv $nonFlakeDir.tmp $nonFlakeDir nix build -o $TEST_ROOT/result flake3#xyzzy flake3#fnord - -# Test doing multiple `lookupFlake`s -nix build -o $TEST_ROOT/result flake4#xyzzy - -# Test 'nix flake update' and --override-flake. -nix flake lock $flake3Dir -[[ -z $(git -C $flake3Dir diff master || echo failed) ]] - -nix flake update --flake "$flake3Dir" --override-flake flake2 nixpkgs -[[ ! -z $(git -C "$flake3Dir" diff master || echo failed) ]] diff --git a/tests/functional2/flakes/test_cli.py b/tests/functional2/flakes/test_cli.py index 9ef03e0ac..abff4725d 100644 --- a/tests/functional2/flakes/test_cli.py +++ b/tests/functional2/flakes/test_cli.py @@ -500,6 +500,25 @@ class TestBuild: # check that the lockfile was changed assert git(flake3, "diff", "HEAD").stdout_s + def test_deep_build(self, nix: Nix, flake3: Path): + """test builds that need recursive flakeref resolution""" + # flake4 points to flake3 which thus needs locked + nix.nix(["flake", "lock", flake3]).run().ok() + nix.nix(["build", "flake4#xyzzy"]).run().ok() + + +@pytest.mark.usefixtures("registry") +def test_update_with_override_flake(nix: Nix, flake3: Path, git: Git): + nix.nix( + ["flake", "update", "--flake", flake3, "--override-input", "flake2", "nixpkgs"] + ).run().ok() + assert git(flake3, "diff", "HEAD").stdout_s + + +def test_symlinks_in_flakes_are_not_flakes(nix: Nix, flake1: Path): + nix.nix(["build", "-o", flake1 / "result", f"git+file://{flake1}"]).run().ok() + nix.nix(["path-info", flake1 / "result"]).run().ok() + @pytest.mark.usefixtures("registry") def test_flakes_gcroots(nix: Nix, flake1: Path, flake2: Path):