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/build-support/trivial-builders: add runCommandLocal #74642
pkgs/build-support/trivial-builders: add runCommandLocal #74642
Conversation
// (if runLocal then { | ||
preferLocalBuild = true; | ||
allowSubstitutes = false; | ||
} else {}) |
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 feel like this should be the other way around, such that env
can override preferLocalBuild
. Also could use optionalAttrs runLocal { ... }
here
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.
You are absolutely right, see force push.
Tested manually with
nix-build -E 'with import ./. {}; runCommandLocal "foo" { x = "y"; preferLocalBuild = false; } "echo $x"'
afd505b
to
affa896
Compare
A definition I’ve been copy-pasting everywhere so far, so it’s finally time to add it to nixpkgs. I’m using a remote builder for my regular nix builds, so trivial `runCommand`s which first try a substitution and then copy the inputs to the builder to run for 0.2s are quite noticable. If we just always build these, we gain some build time, so let’s make it easy to switch from remote to local.
The link in the note points to the `id` added in NixOS/nix#3255, so it might take some time to start working correctly.
This makes it possible to reference single function definitions, for pointing people to their exact definition.
affa896
to
242b043
Compare
We shouldn’t force the user to have a C compiler in scope, just because the derivation is forced to build locally. That can’t be counted as “lightweight” anymore. Co-Authored-By: Silvan Mosberger<contact@infinisil.com>
`runCommandLocal` was added to nixpkgs in NixOS/nixpkgs#74642 to speed up trivial `runCommand` derivations by always building them locally. We have a few places where that’s good to use.
`runCommandLocal` was added to nixpkgs in NixOS/nixpkgs#74642 to speed up trivial `runCommand` derivations by always building them locally. We have a few places where that’s good to use.
A definition I’ve been copy-pasting everywhere so far, so it’s finally
time to add it to nixpkgs.
I’m using a remote builder for my regular nix builds, so trivial
runCommand
s which first try a substitution and then copy the inputsto the builder to run for 0.2s are quite noticable.
If we just always build these, we gain some build time, so let’s make
it easy to switch from remote to local.
Motivation for this change
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)Notify maintainers
cc @infinisil