Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/libfetchers/registry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ static std::shared_ptr<Registry> getGlobalRegistry(const Settings & settings, St
store2->addPermRoot(storePath, (getCacheDir() / "flake-registry.json").string());
return {store.requireStoreObjectAccessor(storePath)};
} else {
return SourcePath{makeFSSourceAccessor(path)}.resolveSymlinks();
return SourcePath{getFSSourceAccessor(), CanonPath{path}}.resolveSymlinks();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the changes to the fd *at-based source accessor I debated adding a function that opens an accessor while following symlinks for this purpose. Would be nicer to use that eventually

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I want to do try that too. I'll merge this as fixing the bug and testing is priority no. 1 though.

}
}(),
Registry::Global);
Expand Down
6 changes: 6 additions & 0 deletions tests/functional/flakes/flakes.sh
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,12 @@ nix store gc
nix registry list --flake-registry "file://$registry" --refresh | grepQuiet flake3
mv "$registry.tmp" "$registry"

# A symlinked registry file should work even when the symlink target is
# an absolute path. The source accessor needs to be rooted at `/` for this.
ln -sfn "$registry" "$TEST_ROOT/registry-symlink.json"
nix registry list --flake-registry "$TEST_ROOT/registry-symlink.json" | grepQuiet flake1
rm "$TEST_ROOT/registry-symlink.json"

# Ensure that locking ignores the user registry.
mkdir -p "$TEST_HOME/.config/nix"
ln -sfn "$registry" "$TEST_HOME/.config/nix/registry.json"
Expand Down
Loading