-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
{stdenv,ninja}: add support for NIX_LOAD_LIMIT
#328677
base: staging
Are you sure you want to change the base?
Conversation
ad969e7
to
f76f312
Compare
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.
Looks pretty straightforward to me after getting a primer on Bash :+
syntax and looking up what -l
does for ninja and make.
@@ -10,6 +10,7 @@ ninjaBuildPhase() { | |||
|
|||
local flagsArray=( | |||
-j$buildCores | |||
${NIX_LOAD_LIMIT:+-l${NIX_LOAD_LIMIT}} |
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.
From ninja --help
:
-l N do not start new jobs if the load average is greater than N
@@ -1391,6 +1403,7 @@ buildPhase() { | |||
local flagsArray=( | |||
${enableParallelBuilding:+-j${NIX_BUILD_CORES}} | |||
SHELL="$SHELL" | |||
${NIX_LOAD_LIMIT:+-l${NIX_LOAD_LIMIT}} |
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.
From make --help
:
-l [N], --load-average[=N], --max-load[=N]
Don't start multiple jobs unless load is below N.
NIX_BUILD_CORES="${NIX_BUILD_CORES:-1}" | ||
if ((NIX_BUILD_CORES <= 0)); then | ||
guess=$(nproc 2>/dev/null || true) | ||
((NIX_BUILD_CORES = guess <= 0 ? 1 : guess)) | ||
if test "$NIX_BUILD_CORES" -le 0; then |
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 you can combine these two lines like you've done with NIX_LOAD_LIMIT
.
Description of changes
See: NixOS/nix#11143
Untested draft, do not merge, warning warning warning.
Copious previous discussion and events: #174473, #184886, #192447, #192799.
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.