Skip to content

nixos: remove allowSubstitutes = false from core modules#221041

Closed
lovesegfault wants to merge 1 commit intoNixOS:masterfrom
lovesegfault:nixos-allow-subs
Closed

nixos: remove allowSubstitutes = false from core modules#221041
lovesegfault wants to merge 1 commit intoNixOS:masterfrom
lovesegfault:nixos-allow-subs

Conversation

@lovesegfault
Copy link
Member

Description of changes

These are used almost anywhere, and make building only uncached parts of
a NixOS system extremely annoying. They all already have preferLocal = true set, which should be enough to prevent them from being built
remotely, where the largest perf hit would be seen.

Alternatively, we could introduce a top-level config option to NixOS like
substituteTrivialDerivations to let users toggle this behavior.

IMO, these derivations produce tiny files, and fetching them from a substituter
is probably not significantly worse than building them locally.

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.

These are used almost anywhere, and make building only uncached parts of
a NixOS system extremely annoying. They all already have `preferLocal =
true` set, which should be enough to prevent them from being built
remotely, where the largest perf hit would be seen.
@lovesegfault lovesegfault requested review from a team and dasJ as code owners March 13, 2023 18:57
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Mar 13, 2023
@lovesegfault
Copy link
Member Author

Another idea would be a config to nixpkgs like alwaysAllowSubstitutes where, if it's true, it just flips the value for any derivations which would set it.

@ofborg ofborg bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels Mar 13, 2023
@lovesegfault
Copy link
Member Author

I made another PR with the config-based approach here: #221048

@ElvishJerricco
Copy link
Contributor

I don't understand what's annoying about not using substitutes for these? Surely, spending the milliseconds it takes to create a trivial file is preferable to reaching out over the network, especially considering how unreliable networking can be. Especially considering debugging network connectivity problems is likely to involve tweaking systemd units directly or indirectly, so you wouldn't want these attempting to reach out to a substituter.

@lovesegfault
Copy link
Member Author

I don't understand what's annoying about not using substitutes for these? Surely, spending the milliseconds it takes to create a trivial file is preferable to reaching out over the network, especially considering how unreliable networking can be. Especially considering debugging network connectivity problems is likely to involve tweaking systemd units directly or indirectly, so you wouldn't want these attempting to reach out to a substituter.

It means your CI is always having to fetch everything it needs to build these, instead of them being properly cached. It's extremely annoying because it balloons the build time of seemingly minor system changes by causing hundreds of paths to be fetched just to build a text file that was already built and cached previously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-darwin: 1 This PR causes 1 package to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants