diff --git a/src/libflake/flake/flakeref.cc b/src/libflake/flake/flakeref.cc index 720f771ab09..fbe61c294dc 100644 --- a/src/libflake/flake/flakeref.cc +++ b/src/libflake/flake/flakeref.cc @@ -107,7 +107,7 @@ std::pair parsePathFlakeRefWithFragment( to 'baseDir'). If so, search upward to the root of the repo (i.e. the directory containing .git). */ - path = absPath(path, baseDir); + path = absPath(path, baseDir, true); if (isFlake) { diff --git a/tests/functional/flakes/meson.build b/tests/functional/flakes/meson.build index cc65dc306a1..af7fb304b7a 100644 --- a/tests/functional/flakes/meson.build +++ b/tests/functional/flakes/meson.build @@ -28,6 +28,7 @@ suites += { 'commit-lock-file-summary.sh', 'non-flake-inputs.sh', 'relative-paths.sh', + 'symlink-paths.sh' ], 'workdir': meson.current_source_dir(), } diff --git a/tests/functional/flakes/symlink-paths.sh b/tests/functional/flakes/symlink-paths.sh new file mode 100644 index 00000000000..2559e81073a --- /dev/null +++ b/tests/functional/flakes/symlink-paths.sh @@ -0,0 +1,75 @@ +#!/usr/bin/env bash + +source ./common.sh + +requireGit + +create_flake() { + local flakeDir="$1" + createGitRepo $flakeDir + cat > $flakeDir/flake.nix < $repoDir/subdir/flake.nix < $repoDir/file + mkdir $repoDir/subdir + cat > $repoDir/subdir/flake.nix < $repo2Dir/file + git -C "$repo2Dir" add flake1_sym file + git -C "$repo2Dir" commit -m Initial + [[ $(nix eval "$repo2Dir/flake1_sym#x") == \"Hello\\n\" ]] + rm -rf "$TEST_ROOT/repo1" "$TEST_ROOT/repo2" +} +test_symlink_from_repo_to_another