diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2010-03-11 16:50:08 +0000 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2010-03-11 16:50:08 +0000 |
commit | a104f07a071c9223d5cf76f7649e74223cdce98b (patch) | |
tree | d1ee4e8e309663c0d2a30449812f459be826c23b /modules/services/misc/nix-daemon.nix | |
parent | 131b1e57fe5593fed88b541b5f943c35c95bf611 (diff) | |
download | nixpkgs-a104f07a071c9223d5cf76f7649e74223cdce98b.tar nixpkgs-a104f07a071c9223d5cf76f7649e74223cdce98b.tar.gz nixpkgs-a104f07a071c9223d5cf76f7649e74223cdce98b.tar.bz2 nixpkgs-a104f07a071c9223d5cf76f7649e74223cdce98b.tar.lz nixpkgs-a104f07a071c9223d5cf76f7649e74223cdce98b.tar.xz nixpkgs-a104f07a071c9223d5cf76f7649e74223cdce98b.tar.zst nixpkgs-a104f07a071c9223d5cf76f7649e74223cdce98b.zip |
* Move the definition of the Nix build users out of user-groups.nix to
nix-daemon.nix. * Add an option ‘nix.nrBuildUsers’ to allow the number of build users to be overriden. svn path=/nixos/trunk/; revision=20571
Diffstat (limited to 'modules/services/misc/nix-daemon.nix')
-rw-r--r-- | modules/services/misc/nix-daemon.nix | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/modules/services/misc/nix-daemon.nix b/modules/services/misc/nix-daemon.nix index ee7136212d5..f347fb8ce47 100644 --- a/modules/services/misc/nix-daemon.nix +++ b/modules/services/misc/nix-daemon.nix @@ -5,6 +5,18 @@ with pkgs.lib; let inherit (config.environment) nix; + + makeNixBuildUser = nr: + { name = "nixbld${toString nr}"; + description = "Nix build user ${toString nr}"; + + /* For consistency with the setgid(2), setuid(2), and setgroups(2) + calls in `libstore/build.cc', don't add any supplementary group + here. */ + uid = builtins.add config.ids.uids.nixbld nr; + group = "nixbld"; + extraGroups = []; + }; in @@ -148,6 +160,17 @@ in Environment variables used by Nix. "; }; + + nrBuildUsers = mkOption { + default = 10; + description = '' + Number of <literal>nixbld</literal> user accounts created to + perform secure concurrent builds. If you receive an error + message saying that “all build users are currently in use”, + you should increase this value. + ''; + }; + }; }; @@ -213,6 +236,9 @@ in '' export PATH=${if config.nix.distributedBuilds then "${pkgs.openssh}/bin:${pkgs.gzip}/bin:" else ""}${pkgs.openssl}/bin:${nix}/bin:$PATH ${config.nix.envVars} + # To reduce the load on Hydra, don't start all those + # unnecessary substituter processes. + export NIX_SUBSTITUTERS= exec \ nice -n ${builtins.toString config.nix.daemonNiceLevel} \ ${pkgs.utillinux}/bin/ionice -n ${builtins.toString config.nix.daemonIONiceLevel} \ @@ -261,6 +287,8 @@ in export ftp_proxy=${config.nix.proxy} ''; + users.extraUsers = map makeNixBuildUser (pkgs.lib.range 1 config.nix.nrBuildUsers); + }; } |