diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-02-16 11:57:36 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-02-16 12:02:49 +0100 |
commit | 5d7000df689f2ee654cbb45ec440764c54074430 (patch) | |
tree | cbabdba21b1e835684524416232a61a132352d6f /nixos | |
parent | 5a0208d117b43fa2c67f1cd935c7123b45b92aff (diff) | |
download | nixlib-5d7000df689f2ee654cbb45ec440764c54074430.tar nixlib-5d7000df689f2ee654cbb45ec440764c54074430.tar.gz nixlib-5d7000df689f2ee654cbb45ec440764c54074430.tar.bz2 nixlib-5d7000df689f2ee654cbb45ec440764c54074430.tar.lz nixlib-5d7000df689f2ee654cbb45ec440764c54074430.tar.xz nixlib-5d7000df689f2ee654cbb45ec440764c54074430.tar.zst nixlib-5d7000df689f2ee654cbb45ec440764c54074430.zip |
Automatically set nix.nrBuildUsers to at least nix.maxJobs
Diffstat (limited to 'nixos')
-rw-r--r-- | nixos/modules/services/misc/nix-daemon.nix | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index 9979c6c9815b..81fabd1923f9 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -67,12 +67,12 @@ in type = types.int; default = 1; example = 64; - description = " + description = '' This option defines the maximum number of jobs that Nix will try to build in parallel. The default is 1. You should generally set it to the number of CPUs in your system (e.g., 2 on an Athlon 64 X2). - "; + ''; }; buildCores = mkOption { @@ -204,7 +204,6 @@ in nrBuildUsers = mkOption { type = types.int; - default = 10; description = '' Number of <literal>nixbld</literal> user accounts created to perform secure concurrent builds. If you receive an error @@ -323,12 +322,9 @@ in fi ''; - users.extraUsers = - if cfg.nrBuildUsers >= cfg.maxJobs then - map makeNixBuildUser (range 1 cfg.nrBuildUsers) - else - throw "Not enough build users (${cfg.nrBuildUsers}) to support ${cfg.maxJobs} build jobs. Change nrBuildUsers or maxJobs." - ; + nix.nrBuildUsers = mkDefault (lib.max 10 cfg.maxJobs); + + users.extraUsers = map makeNixBuildUser (range 1 cfg.nrBuildUsers); system.activationScripts.nix = stringAfter [ "etc" "users" ] '' |