testing: migrate flakes/flakes.sh (part 17)

symlinks in flake dirs, recursive lookups, update with override

Change-Id: I1491ca8e618ff5e06a06d3cc3648ae0750a1ffde
This commit is contained in:
eldritch horrors
2026-02-26 13:11:25 +00:00
parent b92f1aa865
commit 30ce32e2f6
2 changed files with 19 additions and 14 deletions
-14
View File
@@ -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) ]]
+19
View File
@@ -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):