Skip to content

Allow configuration of load limit for nix builds #7091

Open
@jonringer

Description

Is your feature request related to a problem? Please describe.
We have the ability to configure jobs and cores, however, I would like to propose a third value, load-limit. This will allow for a machine-specific value to be passed to make's -l argument. Previously, we were just using the NIX_BUILD_CORES, but this isn't satisfactory, as machines which are configured to run many jobs will have a low core count set to avoid over-subscribing the available cores, and the low core value being set globally for all builds severely limits the throughput.

Describe the solution you'd like
I would like nix to recieve a --load-limit argument, as well as allow for a load-limit nix.conf value. And in a nix build environment having NIX_LOAD_LIMIT be set to the corresponding value.

In my opinion, the default value for load-limit should be:

max(($load-limit or system_cores), $cores)

or in English, "Take the load-limit value from nix.conf or passed as argument, if not available, then determine the system cores impurely. Take the the cores nix.conf or argument value if it's larger"

Describe alternatives you've considered
None which are satisfactory.

Additional context
Nixpkgs PRs:

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions