{stdenv,ninja}: add support for NIX_LOAD_LIMIT#328677
Draft
emilazy wants to merge 1 commit intoNixOS:stagingfrom
Draft
{stdenv,ninja}: add support for NIX_LOAD_LIMIT#328677emilazy wants to merge 1 commit intoNixOS:stagingfrom
NIX_LOAD_LIMIT#328677emilazy wants to merge 1 commit intoNixOS:stagingfrom
Conversation
ad969e7 to
f76f312
Compare
This was referenced Jul 21, 2024
philiptaron
approved these changes
Aug 2, 2024
Contributor
philiptaron
left a comment
There was a problem hiding this comment.
Looks pretty straightforward to me after getting a primer on Bash :+ syntax and looking up what -l does for ninja and make.
|
|
||
| local flagsArray=( | ||
| -j$buildCores | ||
| ${NIX_LOAD_LIMIT:+-l${NIX_LOAD_LIMIT}} |
Contributor
There was a problem hiding this comment.
From ninja --help:
-l N do not start new jobs if the load average is greater than N
| local flagsArray=( | ||
| ${enableParallelBuilding:+-j${NIX_BUILD_CORES}} | ||
| SHELL="$SHELL" | ||
| ${NIX_LOAD_LIMIT:+-l${NIX_LOAD_LIMIT}} |
Contributor
There was a problem hiding this comment.
From make --help:
-l [N], --load-average[=N], --max-load[=N]
Don't start multiple jobs unless load is below N.
Comment on lines
874
to
+875
| 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 |
Contributor
There was a problem hiding this comment.
I think you can combine these two lines like you've done with NIX_LOAD_LIMIT.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 = relaxedsandbox = truenix-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.