-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
feat: add always-allow-substitutes #8047
Conversation
You can see this working here: https://github.com/lovesegfault/nix-config/actions/runs/4418436516/jobs/7745815829 Everything had already been cached by a previous run of the CI, and the subsequent run was essentially a no-op since |
cc. @edolstra |
@lovesegfault The maintainers team will triage this PR in one of the next meetings. Please be patient, we have a lot of open PRs to deal with, and many of them take more than one session to even decide over if they're reasonable to begin with. |
@fricklerhandwerk Follow-up on this? It's such a simple PR and brings huge wins for users of Nix in CI. |
Still in the triage backlog, I suppose the team will take a look on Friday. Note that new features are currently fairly low in priority, due to many design decisions that still have to be made. |
Just an update, I've been running this patch on all my hosts for ~1 month without issues. @fricklerhandwerk I assume it still hasn't been triaged? |
Yes, sorry, we have a huge backlog, and the next two weeks will be slow due to days off. |
Triaged in Nix team meeting: We're not sure if this is the right solution to the underlying problem. Maybe we should instead remove Complete discussion
|
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-04-28-nix-team-meeting-minutes-50/27698/1 |
My argument is that what is proposed here can improve the experience for users right now, without representing meaningful future risk. Adding this option does not restrict the solution space here, we can still choose to remove It's hard for me to see how it's better to do nothing now than to allow people to opt-out of a “broken” feature that might get removed in the future, especially given the simplicity of the patch here. I want to emphasize how much better the experience of Nix in CI is with this, and it's a use case that's really common. I would really appreciate if there was bias for action here, given that this is a non-invasive immediate solution to a real issue for a mainstream use-case of Nix. |
A follow-up thought, this could even enable us to just flip |
I fully support merging this and using it as a stepping stone towards the removal of this feature. |
This adds a new configuration option to Nix, `always-allow-substitutes`, whose effect is simple: it causes the `allowSubstitutes` attribute in derivations to be ignored, and for substituters to always be used. This is extremely valuable for users of Nix in CI, where usually `nix-build-uncached` is used. There, derivations which disallow substitutes cause headaches as the inputs for building already-cached derivations need to be fetched to spuriously rebuild some simple text file. This option should be a good middle-ground, since it doesn't imply rebuilding the world, such as the approach I took in NixOS/nixpkgs#221048
1ad8638
to
bf69331
Compare
A good example for is when local system and target systems don't match. Nix currently insists on building and thus fails. |
@fricklerhandwerk Is there a way to request this to be reconsidered given the comments since it was last discussed? I'd be happy to show up to the next team meeting and talk about this PR too, though I'm not sure when/where it will happen, or whether it's open to folks popping in :) |
I've been using this for a few days and substituting things like steam-fhs takes a long time despite the package itself only being symlinks. |
Discussed during the Nix team meeting: This isn't a great long-term solution (adding a layer to fix a broken layer), but it's a good-enough stop-gap. Agreement to accept this, with an explicit mention that it's a stop-gap and not a viable long-term solution |
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/2023-07-24-nix-team-meeting-minutes-74/31116/1 |
Pinging @roberth for review :) |
Pinging @roberth again |
I think you mean when the derivation |
@@ -122,7 +122,7 @@ bool ParsedDerivation::willBuildLocally(Store & localStore) const | |||
|
|||
bool ParsedDerivation::substitutesAllowed() const | |||
{ | |||
return getBoolAttr("allowSubstitutes", true); | |||
return settings.alwaysAllowSubstitutes ? true : getBoolAttr("allowSubstitutes", 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.
This is really not a property of a "parsed derivation", but rather a property of the desired scheduling approach.
Not happy about that, but it's a structural problem, not a new thing.
feat: add always-allow-substitutes (cherry picked from commit da2b59a) Change-Id: I50481cd8fe643c673c610fec28bad84519a4d650
This pull request has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/nix-build-not-downloading-everything-from-cache/60680/4 |
Motivation
This adds a new configuration option to Nix,
always-allow-substitutes
,whose effect is simple: it causes the
allowSubstitutes
attribute inderivations to be ignored, and for substituters to always be used.
This option should be a good middle-ground, since it doesn't imply
rebuilding the world, such as the approach I took in
See Also:
Context
This is extremely valuable for users of Nix in CI, where usually
nix-build-uncached
is used. There, derivations which disallowsubstitutes cause headaches as the inputs for building already-cached
derivations need to be fetched to spuriously rebuild some simple text
file.
Checklist for maintainers
Maintainers: tick if completed or explain if not relevant
tests/**.sh
src/*/tests
tests/nixos/*
Priorities
Add 👍 to pull requests you find important.