Skip to content

Rewrite StoreConfig::getUri in terms of new StoreConfig::getReference#13739

Merged
xokdvium merged 1 commit intoNixOS:masterfrom
obsidiansystems:getUri-not-string
Aug 13, 2025
Merged

Rewrite StoreConfig::getUri in terms of new StoreConfig::getReference#13739
xokdvium merged 1 commit intoNixOS:masterfrom
obsidiansystems:getUri-not-string

Conversation

@Ericson2314
Copy link
Copy Markdown
Member

Motivation

Rather than having store implementations return a free-form URI string, have them return a StoreReference. This reflects that fact that this method is supposed to invert resolveStoreConfig, which goes from a StoreReference to some StoreConfig concrete derived class (based on the registry).

Context

StoreConfig::getUri is kept only as a convenience for the common case that we want to immediately render the StoreReference.

A few tests were changed to use local:// not local, since StoreReference does not encode the local and daemon shorthands (and instead desugars them to local:// and unix:// right away). I think that is fine. local and daemon still work as input.


Add 👍 to pull requests you find important.

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

@Ericson2314 Ericson2314 requested a review from edolstra as a code owner August 12, 2025 14:59
@Ericson2314 Ericson2314 requested a review from xokdvium August 12, 2025 14:59
@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 c api Nix as a C library with a stable interface labels Aug 12, 2025
@xokdvium
Copy link
Copy Markdown
Contributor

@Ericson2314, CI is failing. Otherwise SGTM

@Ericson2314
Copy link
Copy Markdown
Member Author

@xokdvium Yeah, its daemon tests. Will need some local:// vs local conditions, I guess.

@Ericson2314
Copy link
Copy Markdown
Member Author

Let's see now...

@xokdvium
Copy link
Copy Markdown
Contributor

Let's see now...

nix-daemon-compat-tests> +(store-info.sh:9) echo 'Store URL: unix://
nix-daemon-compat-tests> Version: 2.31.0pre20250812_b9e4f99
nix-daemon-compat-tests> Trusted: 1'
nix-daemon-compat-tests> +(store-info.sh:9) grep 'Store URL: daemon'

@Ericson2314
Copy link
Copy Markdown
Member Author

Ericson2314 commented Aug 12, 2025

Oh, there is more of it....

Have to also handle the case where the NIX_REMOTE we set is not exactly what we get back

@Ericson2314
Copy link
Copy Markdown
Member Author

Now it normalizes the Store URLs in that test, which should work regardless of the daemon version

@Mic92
Copy link
Copy Markdown
Member

Mic92 commented Aug 13, 2025

@Ericson2314 Ericson2314 force-pushed the getUri-not-string branch 3 times, most recently from d870842 to 5fda299 Compare August 13, 2025 22:27
…nce`

Rather than having store implementations return a free-form URI string,
have them return a `StoreReference`. This reflects that fact that this
method is supposed to invert `resolveStoreConfig`, which goes from a
`StoreReference` to some `StoreConfig` concrete derived class (based on
the registry).

`StoreConfig::getUri` is kept only as a convenience for the common case
that we want to immediately render the `StoreReference`.

A few tests were changed to use `local://` not `local`, since
`StoreReference` does not encode the `local` and `daemon` shorthands
(and instead desugars them to `local://` and `unix://` right away). I
think that is fine. `local` and `daemon` still work as input.
@xokdvium xokdvium merged commit cf7084a into NixOS:master Aug 13, 2025
14 checks passed
@Ericson2314 Ericson2314 deleted the getUri-not-string branch August 14, 2025 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c api Nix as a C library with a stable interface 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.

3 participants