Skip to content

Use getFSSourceAccessor only for the evaluator's root file system - #16854

Open
Ericson2314 wants to merge 4 commits into
masterfrom
registry-fs-accessor
Open

Ericson2314 wants to merge 4 commits into
masterfrom
registry-fs-accessor

Conversation

@Ericson2314

Copy link
Copy Markdown
Member

The flake registries and --reference-lock-file now read their file through an accessor from makeFSSourceAccessor, rather than one for the whole host file system.

getFSSourceAccessor would be lovely to delete. But it is used in one spot we cannot get rid of. See the new doxygen from it.

Also while we are at it, use ref<Registry> not
std::shared_ptr<Registry> in a number of places to indicate non-null.

Assisted-by: Claude Code (Claude Opus 5.5)


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@github-actions github-actions Bot added new-cli Relating to the "nix" command fetching Networking with the outside (non-Nix) world, input locking labels Nov 19, 2026
Comment thread src/libcmd/installables.cc Resolved
Comment thread src/libfetchers/registry.cc Resolved
Comment thread src/libfetchers/registry.cc Outdated
Comment on lines 126 to 127
static auto systemRegistry = readMaybeHostRegistry(settings, getSystemRegistryPath(), Registry::System);
return systemRegistry;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Isn't there an existing PR that just reads the stuff into a memory source accessor now?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

There is, it is #16481, I will rebase that on top.

Its root is an empty directory, which exists, rather than nothing at
all, which is easy to forget when using it for a path that should not
exist.

Assisted-by: Claude Code (Claude Opus 5.5)
@github-actions github-actions Bot added with-tests Issues related to testing. PRs with tests have some priority store Issues and pull requests concerning the Nix store labels Nov 19, 2026
@Ericson2314
Ericson2314 force-pushed the registry-fs-accessor branch 2 times, most recently from 2b23f64 to 2d3eea1 Compare November 19, 2026 23:46
Comment thread src/libutil/posix-source-accessor.cc Outdated
Comment on lines +800 to +801
auto [trackLastModified, finalSymlink, requireAbsolute] = params;
assert(!requireAbsolute || root.is_absolute());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This will mess up showPath and getPhysicalPath and whatnot.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh bummer, because our absPath is sketchy.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed but left a TODO

Comment thread src/libutil/posix-source-accessor.cc Resolved
`trackLastModified` and `finalSymlink` move into
`MakeFSSourceAccessorParams`, so that callers can set just the one they
need with designated initializers, rather than spelling out the
defaults before it.

It also gets `requireAbsolute`, default true, for callers that take a
user-given path: with it false, a relative root is made absolute with
`absPath`, rather than each caller doing so first.

Assisted-by: Claude Code (Claude Opus 5.5)
…::read`

`push_back` already says it is a `Registry::Entry`. Also put one field
per line with a trailing comma, as elsewhere.

Assisted-by: Claude Code (Claude Opus 5.5)
The flake registries and `--reference-lock-file` now read their file
through an accessor from `makeFSSourceAccessor`, rather than one for the
whole host file system.

That leaves the evaluator's root file system, which now calls
`makeFSSourceAccessor("/")` itself, with a comment explaining why it is
the one place that should read the whole host file system.

`makeFSSourceAccessorOrError` handles files that may not exist, without
having to check first.

Also while we are at it, use `ref<Registry>` not
`std::shared_ptr<Registry>` in a number of places to indicate non-null.

Assisted-by: Claude Code (Claude Opus 5.5)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fetching Networking with the outside (non-Nix) world, input locking new-cli Relating to the "nix" command store Issues and pull requests concerning the Nix store with-tests Issues related to testing. PRs with tests have some priority

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants