-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create StoreReference
and use it in Machine
#9839
Create StoreReference
and use it in Machine
#9839
Conversation
src/libstore/store-uri.cc
Outdated
} | ||
|
||
|
||
std::string StoreURI::render() const |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason you chose "render" over "to_string"? Seems like an odd choice to me.
In particular `local://<path>` and `unix://` (without any path) now work, and mean the same things as `local` and `daemon`, respectively. We thus now have the opportunity to desguar `local` and `daemon` early. This will allow me to make a change to NixOS#9839 requested during review to desugar those earlier.
In particular `local://<path>` and `unix://` (without any path) now work, and mean the same things as `local` and `daemon`, respectively. We thus now have the opportunity to desguar `local` and `daemon` early. This will allow me to make a change to NixOS#9839 requested during review to desugar those earlier.
In particular `local://<path>` and `unix://` (without any path) now work, and mean the same things as `local` and `daemon`, respectively. We thus now have the opportunity to desguar `local` and `daemon` early. This will allow me to make a change to NixOS#9839 requested during review to desugar those earlier. Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2024-02-03-nix-team-meeting-127/40309/1 |
In particular `local://<path>` and `unix://` (without any path) now work, and mean the same things as `local` and `daemon`, respectively. We thus now have the opportunity to desguar `local` and `daemon` early. This will allow me to make a change to NixOS#9839 requested during review to desugar those earlier. Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
In particular `local://<path>` and `unix://` (without any path) now work, and mean the same things as `local` and `daemon`, respectively. We thus now have the opportunity to desguar `local` and `daemon` early. This will allow me to make a change to NixOS#9839 requested during review to desugar those earlier. Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com>
0998173
to
2ca7fce
Compare
2ca7fce
to
94e43a2
Compare
82f2d76
to
5660d44
Compare
@@ -37,7 +37,7 @@ static std::string currentLoad; | |||
|
|||
static AutoCloseFD openSlotLock(const Machine & m, uint64_t slot) | |||
{ | |||
return openLockFile(fmt("%s/%s-%d", currentLoad, escapeUri(m.storeUri), slot), true); | |||
return openLockFile(fmt("%s/%s-%d", currentLoad, escapeUri(m.storeUri.render()), slot), true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we have a problem here. Considering that we also have params
in the URI, which do not affect the identity of the store to be opened, is this actually suitable for use in the name of a lock?
It's a pre-existing issue, fwiw.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes definitely a preexisting issue. If anything, we're better able to deal with it now.
StoreURI
and use it in Machine
StoreReference
and use it in Machine
src/libstore/machines.cc
Outdated
storeUri([&storeUri]{ | ||
try { | ||
return StoreReference::parse(storeUri); | ||
} catch (UsageError &) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is nasty. Should we deprecate this old syntax?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this be done during config parsing instead? That way nix show-config
will show the correct syntax.
Also no chance to accidentally keep using this hack when we improve the settings format.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to parse more eagerly, but that felt like a change best kept for later. (Similarly, using Setting<StoreReference>
for a bunch of things.)
Right now, this is just supposed to match the back compat hack that was there before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just restored the old method of compat for now. We can decide separately whether such try-catch is worth it.
src/libstore/machines.cc
Outdated
} catch (UsageError &) { | ||
// Backwards compatibility: if the URI is invalid, it might | ||
// be bare host name. | ||
return StoreReference::parse("ssh://" + storeUri); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If this fails, we should throw the error for the unmodified string, not the new one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just restored the old method of compat for now. We can decide separately whether such try-catch is worth it.
849c8ab
to
a63c888
Compare
For long expressions, one argument or parameter per line is just easier.
Need to decouple parsing from actually opening a store for Machine configs. Co-authored-by: Théophane Hufschmitt <7226587+thufschmitt@users.noreply.github.com> Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
This will be needed for the next step. Also allows us to write round trip tests.
This makes the remote builder abstract syntax more robust.
a63c888
to
b3ebcc5
Compare
With NixOS/nix#9839, the `storeUri` field is much better structured, so we can use it while still opening the SSH connection ourselves.
Motivation
Separating parsing the URI from opening the store allows for a more robust
Machine
data type that is easier to use.Context
Helps with Hydra dedup too NixOS/hydra#1164
Depends on #9850Priorities and Process
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.