mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 06:26:15 +02:00
Simplify flake tests
This commit is contained in:
parent
ab41e9d543
commit
99c8e7a48d
2 changed files with 66 additions and 66 deletions
131
tests/flakes.sh
131
tests/flakes.sh
|
@ -114,52 +114,52 @@ cat > $registry <<EOF
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
# Test 'nix flake list'.
|
# Test 'nix flake list'.
|
||||||
(( $(nix flake list --flake-registry $registry | wc -l) == 6 ))
|
(( $(nix flake list | wc -l) == 6 ))
|
||||||
|
|
||||||
# Test 'nix flake info'.
|
# Test 'nix flake info'.
|
||||||
nix flake info --flake-registry $registry flake1 | grep -q 'URL: .*flake1.*'
|
nix flake info flake1 | grep -q 'URL: .*flake1.*'
|
||||||
|
|
||||||
# Test 'nix flake info' on a local flake.
|
# Test 'nix flake info' on a local flake.
|
||||||
(cd $flake1Dir && nix flake info --flake-registry $registry) | grep -q 'URL: .*flake1.*'
|
(cd $flake1Dir && nix flake info) | grep -q 'URL: .*flake1.*'
|
||||||
(cd $flake1Dir && nix flake info --flake-registry $registry .) | grep -q 'URL: .*flake1.*'
|
(cd $flake1Dir && nix flake info .) | grep -q 'URL: .*flake1.*'
|
||||||
nix flake info --flake-registry $registry $flake1Dir | grep -q 'URL: .*flake1.*'
|
nix flake info $flake1Dir | grep -q 'URL: .*flake1.*'
|
||||||
|
|
||||||
# Test 'nix flake info --json'.
|
# Test 'nix flake info --json'.
|
||||||
json=$(nix flake info --flake-registry $registry flake1 --json | jq .)
|
json=$(nix flake info flake1 --json | jq .)
|
||||||
[[ $(echo "$json" | jq -r .description) = 'Bla bla' ]]
|
[[ $(echo "$json" | jq -r .description) = 'Bla bla' ]]
|
||||||
[[ -d $(echo "$json" | jq -r .path) ]]
|
[[ -d $(echo "$json" | jq -r .path) ]]
|
||||||
[[ $(echo "$json" | jq -r .lastModified) = $(git -C $flake1Dir log -n1 --format=%ct) ]]
|
[[ $(echo "$json" | jq -r .lastModified) = $(git -C $flake1Dir log -n1 --format=%ct) ]]
|
||||||
|
|
||||||
# Test 'nix build' on a flake.
|
# Test 'nix build' on a flake.
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry flake1#foo
|
nix build -o $TEST_ROOT/result flake1#foo
|
||||||
[[ -e $TEST_ROOT/result/hello ]]
|
[[ -e $TEST_ROOT/result/hello ]]
|
||||||
|
|
||||||
# Test defaultPackage.
|
# Test defaultPackage.
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry flake1
|
nix build -o $TEST_ROOT/result flake1
|
||||||
[[ -e $TEST_ROOT/result/hello ]]
|
[[ -e $TEST_ROOT/result/hello ]]
|
||||||
|
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry $flake1Dir
|
nix build -o $TEST_ROOT/result $flake1Dir
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry git+file://$flake1Dir
|
nix build -o $TEST_ROOT/result git+file://$flake1Dir
|
||||||
|
|
||||||
# Check that store symlinks inside a flake are not interpreted as flakes.
|
# Check that store symlinks inside a flake are not interpreted as flakes.
|
||||||
nix build -o $flake1Dir/result --flake-registry $registry git+file://$flake1Dir
|
nix build -o $flake1Dir/result git+file://$flake1Dir
|
||||||
nix path-info $flake1Dir/result
|
nix path-info $flake1Dir/result
|
||||||
|
|
||||||
# Building a flake with an unlocked dependency should fail in pure mode.
|
# Building a flake with an unlocked dependency should fail in pure mode.
|
||||||
(! nix build -o $TEST_ROOT/result --flake-registry $registry flake2#bar --no-registries)
|
(! nix build -o $TEST_ROOT/result flake2#bar --no-registries)
|
||||||
(! nix eval --expr "builtins.getFlake \"$flake2Dir\"")
|
(! nix eval --expr "builtins.getFlake \"$flake2Dir\"")
|
||||||
|
|
||||||
# But should succeed in impure mode.
|
# But should succeed in impure mode.
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry flake2#bar --impure
|
nix build -o $TEST_ROOT/result flake2#bar --impure
|
||||||
|
|
||||||
# Test automatic lock file generation.
|
# Test automatic lock file generation.
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry $flake2Dir#bar
|
nix build -o $TEST_ROOT/result $flake2Dir#bar
|
||||||
[[ -e $flake2Dir/flake.lock ]]
|
[[ -e $flake2Dir/flake.lock ]]
|
||||||
git -C $flake2Dir add flake.lock
|
git -C $flake2Dir add flake.lock
|
||||||
git -C $flake2Dir commit flake.lock -m 'Add flake.lock'
|
git -C $flake2Dir commit flake.lock -m 'Add flake.lock'
|
||||||
|
|
||||||
# Rerunning the build should not change the lockfile.
|
# Rerunning the build should not change the lockfile.
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry $flake2Dir#bar
|
nix build -o $TEST_ROOT/result $flake2Dir#bar
|
||||||
[[ -z $(git -C $flake2Dir diff master) ]]
|
[[ -z $(git -C $flake2Dir diff master) ]]
|
||||||
|
|
||||||
# Building with a lockfile should not require a fetch of the registry.
|
# Building with a lockfile should not require a fetch of the registry.
|
||||||
|
@ -167,18 +167,17 @@ nix build -o $TEST_ROOT/result --flake-registry file:///no-registry.json $flake2
|
||||||
nix build -o $TEST_ROOT/result --no-registries $flake2Dir#bar --tarball-ttl 0
|
nix build -o $TEST_ROOT/result --no-registries $flake2Dir#bar --tarball-ttl 0
|
||||||
|
|
||||||
# Updating the flake should not change the lockfile.
|
# Updating the flake should not change the lockfile.
|
||||||
nix flake update --flake-registry $registry $flake2Dir
|
nix flake update $flake2Dir
|
||||||
[[ -z $(git -C $flake2Dir diff master) ]]
|
[[ -z $(git -C $flake2Dir diff master) ]]
|
||||||
|
|
||||||
# Now we should be able to build the flake in pure mode.
|
# Now we should be able to build the flake in pure mode.
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry flake2#bar
|
nix build -o $TEST_ROOT/result flake2#bar
|
||||||
|
|
||||||
# Or without a registry.
|
# Or without a registry.
|
||||||
# FIXME: shouldn't need '--flake-registry /no-registry'?
|
nix build -o $TEST_ROOT/result --no-registries git+file://$flake2Dir#bar --tarball-ttl 0
|
||||||
nix build -o $TEST_ROOT/result --flake-registry /no-registry git+file://$flake2Dir#bar --tarball-ttl 0
|
|
||||||
|
|
||||||
# Test whether indirect dependencies work.
|
# Test whether indirect dependencies work.
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry $flake3Dir#xyzzy
|
nix build -o $TEST_ROOT/result $flake3Dir#xyzzy
|
||||||
git -C $flake3Dir add flake.lock
|
git -C $flake3Dir add flake.lock
|
||||||
|
|
||||||
# Add dependency to flake3.
|
# Add dependency to flake3.
|
||||||
|
@ -201,8 +200,8 @@ git -C $flake3Dir add flake.nix
|
||||||
git -C $flake3Dir commit -m 'Update flake.nix'
|
git -C $flake3Dir commit -m 'Update flake.nix'
|
||||||
|
|
||||||
# Check whether `nix build` works with an incomplete lockfile
|
# Check whether `nix build` works with an incomplete lockfile
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry $flake3Dir#"sth sth"
|
nix build -o $TEST_ROOT/result $flake3Dir#"sth sth"
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry $flake3Dir#"sth%20sth"
|
nix build -o $TEST_ROOT/result $flake3Dir#"sth%20sth"
|
||||||
|
|
||||||
# Check whether it saved the lockfile
|
# Check whether it saved the lockfile
|
||||||
(! [[ -z $(git -C $flake3Dir diff master) ]])
|
(! [[ -z $(git -C $flake3Dir diff master) ]])
|
||||||
|
@ -213,7 +212,7 @@ git -C $flake3Dir commit -m 'Add lockfile'
|
||||||
|
|
||||||
# Unsupported editions should be an error.
|
# Unsupported editions should be an error.
|
||||||
sed -i $flake3Dir/flake.nix -e s/201909/201912/
|
sed -i $flake3Dir/flake.nix -e s/201909/201912/
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry $flake3Dir#sth 2>&1 | grep 'unsupported edition'
|
nix build -o $TEST_ROOT/result $flake3Dir#sth 2>&1 | grep 'unsupported edition'
|
||||||
|
|
||||||
# Test whether registry caching works.
|
# Test whether registry caching works.
|
||||||
nix flake list --flake-registry file://$registry | grep -q flake3
|
nix flake list --flake-registry file://$registry | grep -q flake3
|
||||||
|
@ -224,12 +223,12 @@ mv $registry.tmp $registry
|
||||||
# Test whether flakes are registered as GC roots for offline use.
|
# Test whether flakes are registered as GC roots for offline use.
|
||||||
# FIXME: use tarballs rather than git.
|
# FIXME: use tarballs rather than git.
|
||||||
rm -rf $TEST_HOME/.cache
|
rm -rf $TEST_HOME/.cache
|
||||||
_NIX_FORCE_HTTP=1 nix build -o $TEST_ROOT/result --flake-registry file://$registry git+file://$flake2Dir#bar
|
_NIX_FORCE_HTTP=1 nix build -o $TEST_ROOT/result git+file://$flake2Dir#bar
|
||||||
mv $flake1Dir $flake1Dir.tmp
|
mv $flake1Dir $flake1Dir.tmp
|
||||||
mv $flake2Dir $flake2Dir.tmp
|
mv $flake2Dir $flake2Dir.tmp
|
||||||
nix-store --gc
|
nix-store --gc
|
||||||
_NIX_FORCE_HTTP=1 nix build -o $TEST_ROOT/result --flake-registry file://$registry git+file://$flake2Dir#bar
|
_NIX_FORCE_HTTP=1 nix build -o $TEST_ROOT/result git+file://$flake2Dir#bar
|
||||||
_NIX_FORCE_HTTP=1 nix build -o $TEST_ROOT/result --flake-registry file://$registry git+file://$flake2Dir#bar --tarball-ttl 0
|
_NIX_FORCE_HTTP=1 nix build -o $TEST_ROOT/result git+file://$flake2Dir#bar --tarball-ttl 0
|
||||||
mv $flake1Dir.tmp $flake1Dir
|
mv $flake1Dir.tmp $flake1Dir
|
||||||
mv $flake2Dir.tmp $flake2Dir
|
mv $flake2Dir.tmp $flake2Dir
|
||||||
|
|
||||||
|
@ -274,13 +273,13 @@ git -C $flake3Dir commit -m 'Add nonFlakeInputs'
|
||||||
|
|
||||||
# Check whether `nix build` works with a lockfile which is missing a
|
# Check whether `nix build` works with a lockfile which is missing a
|
||||||
# nonFlakeInputs.
|
# nonFlakeInputs.
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry $flake3Dir#sth
|
nix build -o $TEST_ROOT/result $flake3Dir#sth
|
||||||
|
|
||||||
git -C $flake3Dir add flake.lock
|
git -C $flake3Dir add flake.lock
|
||||||
|
|
||||||
git -C $flake3Dir commit -m 'Update nonFlakeInputs'
|
git -C $flake3Dir commit -m 'Update nonFlakeInputs'
|
||||||
|
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry flake3#fnord
|
nix build -o $TEST_ROOT/result flake3#fnord
|
||||||
[[ $(cat $TEST_ROOT/result) = FNORD ]]
|
[[ $(cat $TEST_ROOT/result) = FNORD ]]
|
||||||
|
|
||||||
# Check whether flake input fetching is lazy: flake3#sth does not
|
# Check whether flake input fetching is lazy: flake3#sth does not
|
||||||
|
@ -289,21 +288,21 @@ rm -rf $TEST_HOME/.cache
|
||||||
clearStore
|
clearStore
|
||||||
mv $flake2Dir $flake2Dir.tmp
|
mv $flake2Dir $flake2Dir.tmp
|
||||||
mv $nonFlakeDir $nonFlakeDir.tmp
|
mv $nonFlakeDir $nonFlakeDir.tmp
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry flake3#sth
|
nix build -o $TEST_ROOT/result flake3#sth
|
||||||
(! nix build -o $TEST_ROOT/result --flake-registry $registry flake3#xyzzy)
|
(! nix build -o $TEST_ROOT/result flake3#xyzzy)
|
||||||
(! nix build -o $TEST_ROOT/result --flake-registry $registry flake3#fnord)
|
(! nix build -o $TEST_ROOT/result flake3#fnord)
|
||||||
mv $flake2Dir.tmp $flake2Dir
|
mv $flake2Dir.tmp $flake2Dir
|
||||||
mv $nonFlakeDir.tmp $nonFlakeDir
|
mv $nonFlakeDir.tmp $nonFlakeDir
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry flake3#xyzzy flake3#fnord
|
nix build -o $TEST_ROOT/result flake3#xyzzy flake3#fnord
|
||||||
|
|
||||||
# Test doing multiple `lookupFlake`s
|
# Test doing multiple `lookupFlake`s
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry flake4#xyzzy
|
nix build -o $TEST_ROOT/result flake4#xyzzy
|
||||||
|
|
||||||
# Test 'nix flake update' and --override-flake.
|
# Test 'nix flake update' and --override-flake.
|
||||||
nix flake update --flake-registry $registry $flake3Dir
|
nix flake update $flake3Dir
|
||||||
[[ -z $(git -C $flake3Dir diff master) ]]
|
[[ -z $(git -C $flake3Dir diff master) ]]
|
||||||
|
|
||||||
nix flake update --flake-registry $registry $flake3Dir --recreate-lock-file --override-flake flake2 nixpkgs
|
nix flake update $flake3Dir --recreate-lock-file --override-flake flake2 nixpkgs
|
||||||
[[ ! -z $(git -C $flake3Dir diff master) ]]
|
[[ ! -z $(git -C $flake3Dir diff master) ]]
|
||||||
|
|
||||||
# Make branch "removeXyzzy" where flake3 doesn't have xyzzy anymore
|
# Make branch "removeXyzzy" where flake3 doesn't have xyzzy anymore
|
||||||
|
@ -342,29 +341,29 @@ git -C $flake3Dir commit -m 'Remove packages.xyzzy'
|
||||||
git -C $flake3Dir checkout master
|
git -C $flake3Dir checkout master
|
||||||
|
|
||||||
# Test whether fuzzy-matching works for IsAlias
|
# Test whether fuzzy-matching works for IsAlias
|
||||||
(! nix build -o $TEST_ROOT/result --flake-registry $registry flake4/removeXyzzy#xyzzy)
|
(! nix build -o $TEST_ROOT/result flake4/removeXyzzy#xyzzy)
|
||||||
|
|
||||||
# Test whether fuzzy-matching works for IsGit
|
# 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 flake4/removeXyzzy#xyzzy)
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry flake4/removeXyzzy#sth
|
nix build -o $TEST_ROOT/result flake4/removeXyzzy#sth
|
||||||
|
|
||||||
# Testing the nix CLI
|
# Testing the nix CLI
|
||||||
nix flake add --flake-registry $registry flake1 flake3
|
nix flake add flake1 flake3
|
||||||
(( $(nix flake list --flake-registry $registry | wc -l) == 7 ))
|
(( $(nix flake list | wc -l) == 7 ))
|
||||||
nix flake pin --flake-registry $registry flake1
|
nix flake pin flake1
|
||||||
(( $(nix flake list --flake-registry $registry | wc -l) == 7 ))
|
(( $(nix flake list | wc -l) == 7 ))
|
||||||
nix flake remove --flake-registry $registry flake1
|
nix flake remove flake1
|
||||||
(( $(nix flake list --flake-registry $registry | wc -l) == 6 ))
|
(( $(nix flake list | wc -l) == 6 ))
|
||||||
|
|
||||||
# Test 'nix flake init'.
|
# Test 'nix flake init'.
|
||||||
(cd $flake7Dir && nix flake init)
|
(cd $flake7Dir && nix flake init)
|
||||||
git -C $flake7Dir add flake.nix
|
git -C $flake7Dir add flake.nix
|
||||||
nix flake --flake-registry $registry check $flake7Dir
|
nix flake check $flake7Dir
|
||||||
git -C $flake7Dir commit -m 'Initial'
|
git -C $flake7Dir commit -m 'Initial'
|
||||||
|
|
||||||
# Test 'nix flake clone'.
|
# Test 'nix flake clone'.
|
||||||
rm -rf $TEST_ROOT/flake1-v2
|
rm -rf $TEST_ROOT/flake1-v2
|
||||||
nix flake clone --flake-registry $registry flake1 --dest $TEST_ROOT/flake1-v2
|
nix flake clone flake1 --dest $TEST_ROOT/flake1-v2
|
||||||
[ -e $TEST_ROOT/flake1-v2/flake.nix ]
|
[ -e $TEST_ROOT/flake1-v2/flake.nix ]
|
||||||
|
|
||||||
# More 'nix flake check' tests.
|
# More 'nix flake check' tests.
|
||||||
|
@ -379,7 +378,7 @@ cat > $flake3Dir/flake.nix <<EOF
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
nix flake check --flake-registry $registry $flake3Dir
|
nix flake check $flake3Dir
|
||||||
|
|
||||||
cat > $flake3Dir/flake.nix <<EOF
|
cat > $flake3Dir/flake.nix <<EOF
|
||||||
{
|
{
|
||||||
|
@ -392,7 +391,7 @@ cat > $flake3Dir/flake.nix <<EOF
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
(! nix flake check --flake-registry $registry $flake3Dir)
|
(! nix flake check $flake3Dir)
|
||||||
|
|
||||||
cat > $flake3Dir/flake.nix <<EOF
|
cat > $flake3Dir/flake.nix <<EOF
|
||||||
{
|
{
|
||||||
|
@ -407,7 +406,7 @@ cat > $flake3Dir/flake.nix <<EOF
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
nix flake check --flake-registry $registry $flake3Dir
|
nix flake check $flake3Dir
|
||||||
|
|
||||||
cat > $flake3Dir/flake.nix <<EOF
|
cat > $flake3Dir/flake.nix <<EOF
|
||||||
{
|
{
|
||||||
|
@ -422,7 +421,7 @@ cat > $flake3Dir/flake.nix <<EOF
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
(! nix flake check --flake-registry $registry $flake3Dir)
|
(! nix flake check $flake3Dir)
|
||||||
|
|
||||||
cat > $flake3Dir/flake.nix <<EOF
|
cat > $flake3Dir/flake.nix <<EOF
|
||||||
{
|
{
|
||||||
|
@ -436,7 +435,7 @@ cat > $flake3Dir/flake.nix <<EOF
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
nix flake check --flake-registry $registry $flake3Dir
|
nix flake check $flake3Dir
|
||||||
|
|
||||||
cat > $flake3Dir/flake.nix <<EOF
|
cat > $flake3Dir/flake.nix <<EOF
|
||||||
{
|
{
|
||||||
|
@ -450,7 +449,7 @@ cat > $flake3Dir/flake.nix <<EOF
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
(! nix flake check --flake-registry $registry $flake3Dir)
|
(! nix flake check $flake3Dir)
|
||||||
|
|
||||||
# Test 'follows' inputs.
|
# Test 'follows' inputs.
|
||||||
cat > $flake3Dir/flake.nix <<EOF
|
cat > $flake3Dir/flake.nix <<EOF
|
||||||
|
@ -465,7 +464,7 @@ cat > $flake3Dir/flake.nix <<EOF
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
nix flake update --flake-registry $registry $flake3Dir
|
nix flake update $flake3Dir
|
||||||
[[ $(jq .inputs.foo.url $flake3Dir/flake.lock) = $(jq .inputs.bar.url $flake3Dir/flake.lock) ]]
|
[[ $(jq .inputs.foo.url $flake3Dir/flake.lock) = $(jq .inputs.bar.url $flake3Dir/flake.lock) ]]
|
||||||
|
|
||||||
cat > $flake3Dir/flake.nix <<EOF
|
cat > $flake3Dir/flake.nix <<EOF
|
||||||
|
@ -479,7 +478,7 @@ cat > $flake3Dir/flake.nix <<EOF
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
nix flake update --flake-registry $registry $flake3Dir
|
nix flake update $flake3Dir
|
||||||
[[ $(jq .inputs.bar.url $flake3Dir/flake.lock) =~ flake1 ]]
|
[[ $(jq .inputs.bar.url $flake3Dir/flake.lock) =~ flake1 ]]
|
||||||
|
|
||||||
cat > $flake3Dir/flake.nix <<EOF
|
cat > $flake3Dir/flake.nix <<EOF
|
||||||
|
@ -493,7 +492,7 @@ cat > $flake3Dir/flake.nix <<EOF
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
nix flake update --flake-registry $registry $flake3Dir
|
nix flake update $flake3Dir
|
||||||
[[ $(jq .inputs.bar.url $flake3Dir/flake.lock) =~ flake2 ]]
|
[[ $(jq .inputs.bar.url $flake3Dir/flake.lock) =~ flake2 ]]
|
||||||
|
|
||||||
# Test overriding inputs of inputs.
|
# Test overriding inputs of inputs.
|
||||||
|
@ -508,7 +507,7 @@ cat > $flake3Dir/flake.nix <<EOF
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
nix flake update --flake-registry $registry $flake3Dir
|
nix flake update $flake3Dir
|
||||||
[[ $(jq .inputs.flake2.inputs.flake1.url $flake3Dir/flake.lock) =~ flake7 ]]
|
[[ $(jq .inputs.flake2.inputs.flake1.url $flake3Dir/flake.lock) =~ flake7 ]]
|
||||||
|
|
||||||
cat > $flake3Dir/flake.nix <<EOF
|
cat > $flake3Dir/flake.nix <<EOF
|
||||||
|
@ -523,7 +522,7 @@ cat > $flake3Dir/flake.nix <<EOF
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
nix flake update --flake-registry $registry $flake3Dir --recreate-lock-file
|
nix flake update $flake3Dir --recreate-lock-file
|
||||||
[[ $(jq .inputs.flake2.inputs.flake1.url $flake3Dir/flake.lock) =~ flake7 ]]
|
[[ $(jq .inputs.flake2.inputs.flake1.url $flake3Dir/flake.lock) =~ flake7 ]]
|
||||||
|
|
||||||
# Test Mercurial flakes.
|
# Test Mercurial flakes.
|
||||||
|
@ -550,27 +549,27 @@ EOF
|
||||||
hg add $flake5Dir/flake.nix
|
hg add $flake5Dir/flake.nix
|
||||||
hg commit --config ui.username=foobar@example.org $flake5Dir -m 'Initial commit'
|
hg commit --config ui.username=foobar@example.org $flake5Dir -m 'Initial commit'
|
||||||
|
|
||||||
nix build -o $TEST_ROOT/result --flake-registry $registry hg+file://$flake5Dir
|
nix build -o $TEST_ROOT/result hg+file://$flake5Dir
|
||||||
[[ -e $TEST_ROOT/result/hello ]]
|
[[ -e $TEST_ROOT/result/hello ]]
|
||||||
|
|
||||||
nix flake info --flake-registry $registry --json hg+file://$flake5Dir | jq -e -r .revision
|
nix flake info --json hg+file://$flake5Dir | jq -e -r .revision
|
||||||
|
|
||||||
# This will fail because flake.lock is not tracked by Mercurial.
|
# This will fail because flake.lock is not tracked by Mercurial.
|
||||||
(! nix eval --flake-registry $registry hg+file://$flake5Dir#expr)
|
(! nix eval hg+file://$flake5Dir#expr)
|
||||||
|
|
||||||
hg add $flake5Dir/flake.lock
|
hg add $flake5Dir/flake.lock
|
||||||
|
|
||||||
nix eval --flake-registry $registry hg+file://$flake5Dir#expr
|
nix eval hg+file://$flake5Dir#expr
|
||||||
|
|
||||||
(! nix eval --flake-registry $registry hg+file://$flake5Dir#expr --no-allow-dirty)
|
(! nix eval hg+file://$flake5Dir#expr --no-allow-dirty)
|
||||||
|
|
||||||
(! nix flake info --flake-registry $registry --json hg+file://$flake5Dir | jq -e -r .revision)
|
(! nix flake info --json hg+file://$flake5Dir | jq -e -r .revision)
|
||||||
|
|
||||||
hg commit --config ui.username=foobar@example.org $flake5Dir -m 'Add lock file'
|
hg commit --config ui.username=foobar@example.org $flake5Dir -m 'Add lock file'
|
||||||
|
|
||||||
nix flake info --flake-registry $registry --json hg+file://$flake5Dir --refresh | jq -e -r .revision
|
nix flake info --json hg+file://$flake5Dir --refresh | jq -e -r .revision
|
||||||
nix flake info --flake-registry $registry --json hg+file://$flake5Dir
|
nix flake info --json hg+file://$flake5Dir
|
||||||
[[ $(nix flake info --flake-registry $registry --json hg+file://$flake5Dir | jq -e -r .revCount) = 1 ]]
|
[[ $(nix flake info --json hg+file://$flake5Dir | jq -e -r .revCount) = 1 ]]
|
||||||
|
|
||||||
nix build -o $TEST_ROOT/result hg+file://$flake5Dir --no-registries --no-allow-dirty
|
nix build -o $TEST_ROOT/result hg+file://$flake5Dir --no-registries --no-allow-dirty
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ build-users-group =
|
||||||
keep-derivations = false
|
keep-derivations = false
|
||||||
sandbox = false
|
sandbox = false
|
||||||
experimental-features = nix-command flakes
|
experimental-features = nix-command flakes
|
||||||
|
flake-registry = $TEST_ROOT/registry.json
|
||||||
include nix.conf.extra
|
include nix.conf.extra
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue