nix-daemon: Sanity check maxJobs vs nrBuildUsers

This commit is contained in:
Wout Mertens 2015-02-15 15:37:30 +01:00
parent 750c09c967
commit d41367735d

View File

@ -323,7 +323,12 @@ in
fi
'';
users.extraUsers = map makeNixBuildUser (range 1 cfg.nrBuildUsers);
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."
;
system.activationScripts.nix = stringAfter [ "etc" "users" ]
''