1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-17 22:41:08 +01:00

libstore: Do not normalize daemon -> unix://, local -> local://

This is relied upon (specifically the `local` store) by existing
tooling [1] and we broke this in 3e7879e6df (which
was first released in 2.31).

To lessen the scope of the breakage we should not normalize "auto" references
and explicitly specified references like "local" or "daemon". It also makes
sense to canonicalize local://,daemon:// to be more compatible with prior
behavior.

[1]: 05e1b3cba2/lib/NOM/Builds.hs (L60-L64)
This commit is contained in:
Sergei Zimmerman 2025-09-05 02:56:28 +03:00
parent a0ce514769
commit 3513ab13dc
No known key found for this signature in database
11 changed files with 90 additions and 24 deletions

View file

@ -57,15 +57,16 @@ UDSRemoteStore::UDSRemoteStore(ref<const Config> config)
StoreReference UDSRemoteStoreConfig::getReference() const
{
/* We specifically return "daemon" here instead of "unix://" or "unix://${path}"
* to be more compatible with older versions of nix. Some tooling out there
* tries hard to parse store references and it might not be able to handle "unix://". */
if (path == settings.nixDaemonSocketFile)
return {.variant = StoreReference::Daemon{}};
return {
.variant =
StoreReference::Specified{
.scheme = *uriSchemes().begin(),
// We return the empty string when the path looks like the
// default path, but we could also just return the path
// verbatim always, to be robust to overall config changes
// at the cost of some verbosity.
.authority = path == settings.nixDaemonSocketFile ? "" : path,
.authority = path,
},
};
}