testing: migrate flakes/absolute-paths.sh

Change-Id: Icb9f7e1c8bf17327e32e1ad81f2bfdb4246ba2d7
This commit is contained in:
eldritch horrors
2026-02-17 16:01:00 +01:00
parent 2d73b59679
commit 899c5fe9f0
3 changed files with 20 additions and 18 deletions
-17
View File
@@ -1,17 +0,0 @@
source ./common.sh
requireGit
flake1Dir=$TEST_ROOT/flake1
flake2Dir=$TEST_ROOT/flake2
createGitRepo $flake1Dir
cat > $flake1Dir/flake.nix <<EOF
{
outputs = { self }: { x = builtins.readFile $(pwd)/absolute-paths.sh; };
}
EOF
git -C $flake1Dir add flake.nix
git -C $flake1Dir commit -m Initial
nix eval --impure --json $flake1Dir#x
-1
View File
@@ -41,7 +41,6 @@ functional_tests_scripts = [
'flakes/follow-paths.sh',
'flakes/bundle.sh',
'flakes/unlocked-override.sh',
'flakes/absolute-paths.sh',
'flakes/build-paths.sh',
'flakes/flake-in-submodule.sh',
'flakes/flake-metadata.sh',
@@ -0,0 +1,20 @@
from testlib.fixtures.nix import Nix
from testlib.fixtures.git import Git
from testlib.fixtures.file_helper import with_files, File
from testlib.utils import get_global_asset_pack
from pathlib import Path
@with_files({"flake1": get_global_asset_pack(".git"), "input": File("input")})
def test_absolute_path(nix: Nix, files: Path, git: Git):
nix.settings.add_xp_feature("nix-command", "flakes")
flake = files / "flake1"
(flake / "flake.nix").write_text(f"""{{
outputs = {{ self }}: {{ x = builtins.readFile {files}/input; }};
}}""")
git(flake, "add", "flake.nix")
git(flake, "commit", "-m", "Initial")
assert nix.nix(["eval", "--impure", "--json", f"{flake}#x"]).run().ok().stdout_s == '"input"\n'