Skip to content
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

pkgs/top-level/config: add alwaysAllowSubstitutes #221048

Closed

Conversation

lovesegfault
Copy link
Member

Description of changes

This introduces a new nixpkgs config option, alwaysAllowSubstitutes
which causes allowSubstitutes to always be true.

This is extremely useful for users with fast connections to their cache,
and who prefer to always fetch something from cache. In particular,
those using nix-build-uncached could benefit from this.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.05 Release Notes (or backporting 22.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

This introduces a new nixpkgs config option, `alwaysAllowSubstitutes`
which causes `allowSubstitutes` to always be `true`.

This is extremely useful for users with fast connections to their cache,
and who prefer to _always_ fetch something from cache. In particular,
those using `nix-build-uncached` could benefit from this.
@roberth
Copy link
Member

roberth commented Mar 13, 2023

A Nix setting would be better, not only because of the rebuilds, but also because making sure to always set this config item is a pain, and it probably shouldn't be set by open source expressions.
Ideally we'd race the builder (and its substitution of its deps, etc) against direct substitution in Nix, so that nobody even needs to bother with any of this unnecessary config; neither at the pkgs/config nor at the derivation level.

@lovesegfault
Copy link
Member Author

lovesegfault commented Mar 14, 2023

@roberth Good idea, done: NixOS/nix#4442

I'm going to leave this PR open until we get closure, but I agree my PR to nix is preferable.

lovesegfault added a commit to lovesegfault/nix that referenced this pull request May 22, 2023
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
lovesegfault added a commit to lovesegfault/nix that referenced this pull request Jun 1, 2023
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
lovesegfault added a commit to lovesegfault/nix that referenced this pull request Jun 1, 2023
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
@lovesegfault lovesegfault deleted the config-always-substitute branch June 1, 2023 15:09
@lovesegfault
Copy link
Member Author

We definitely don't want this, the correct solution is the PR to nix, which is stuck.

@roberth
Copy link
Member

roberth commented Jun 1, 2023

It is queued for discussion by the Nix team. So it's not entirely stuck, but it may take a while.

lovesegfault added a commit to lovesegfault/nix that referenced this pull request Jun 16, 2023
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
lovesegfault added a commit to lovesegfault/nix that referenced this pull request Jul 26, 2023
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
lovesegfault added a commit to lovesegfault/nix that referenced this pull request Sep 22, 2023
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
Ericson2314 pushed a commit to obsidiansystems/nix that referenced this pull request Oct 16, 2023
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants