-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
--max-jobs 0 is ignored for preferLocalBuild derivations #1798
Comments
I believe this is the culprit: https://github.com/NixOS/nix/blob/master/src/libstore/build.cc#L1440
buildLocally is set for preferLocalBuild derivations (as well as when --check or some other args are passed, which also causes the build to happen regardless of -j0). Is there a reason that local builds should happen even if maxBuildJobs is 0? Can we just remove this escape hatch? I think if the user sets maxBuildJobs to 0, we really should not start any jobs. |
I'm using the following workaround:
This is essentially a hacky way to call ensurePath for that path. ensurePath fails immediately if the path is not valid and cannot be substituted, without trying to build. That's exactly what I want, so this workaround is perfectly functional for me. You can see how I use it in: https://github.com/catern/nix-utils/blob/master/fixedout.py#L53 Nevertheless, I think the original bug here should be fixed. Also, maybe a direct interface should be provided to use ensurePath? |
This bug pretty annoying especially if you have slow upload, as it first downloads source files locally, and then uploads them to target machine, kinda does not make sense. |
I marked this as stale due to inactivity. → More info |
I still care about this. |
I marked this as stale due to inactivity. → More info |
I still care about this. |
Good news, @catern: |
This looks resolved in post 2.4, though there is an ongoing discussion if this should be the behavior or not. (see linked issues) |
The following command:
should not build; rather it should fail with: "error: unable to start any build; either increase ‘--max-jobs’ or enable distributed builds".
Yet it does (try to) build:
Among other things, this makes it harder to work around the lack of #1734 because builds will still be carried out when -j0 is passed, rather than forcing either substitution or immediate failure.
The text was updated successfully, but these errors were encountered: