diff options
author | Alexander V. Nikolaev <avn@avnik.info> | 2020-03-23 01:47:12 +0200 |
---|---|---|
committer | Alexander V. Nikolaev <avn@avnik.info> | 2020-04-18 20:31:04 +0300 |
commit | 5291925fd2486175e781669412fa5a525da7602a (patch) | |
tree | cebc48922ab792c40157c6e13027b8e2b158f0d2 /nixos/modules/services/misc/nix-daemon.nix | |
parent | 192485f8fab8bd7dce972ff46aa5d8012d5adc09 (diff) | |
download | nixpkgs-5291925fd2486175e781669412fa5a525da7602a.tar nixpkgs-5291925fd2486175e781669412fa5a525da7602a.tar.gz nixpkgs-5291925fd2486175e781669412fa5a525da7602a.tar.bz2 nixpkgs-5291925fd2486175e781669412fa5a525da7602a.tar.lz nixpkgs-5291925fd2486175e781669412fa5a525da7602a.tar.xz nixpkgs-5291925fd2486175e781669412fa5a525da7602a.tar.zst nixpkgs-5291925fd2486175e781669412fa5a525da7602a.zip |
nixos: Introduce nix.buildLocation option
Allow to specify where package build will happens. It helps big packages (like browsers) not to overflow tmpfs.
Diffstat (limited to 'nixos/modules/services/misc/nix-daemon.nix')
-rw-r--r-- | nixos/modules/services/misc/nix-daemon.nix | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/nixos/modules/services/misc/nix-daemon.nix b/nixos/modules/services/misc/nix-daemon.nix index 0c2407e1dd2..022ddad8f36 100644 --- a/nixos/modules/services/misc/nix-daemon.nix +++ b/nixos/modules/services/misc/nix-daemon.nix @@ -430,6 +430,16 @@ in ''; }; + buildLocation = mkOption { + type = types.str; + default = "/tmp"; + example = "/var/buildroot"; + description = '' + Temporary directory, which used to unpack and build source packages. + (by default <filename>/tmp</filename> is used, which commonly reside on tmpfs, + and big packages (like browsers) can just not fit there) + ''; + }; }; }; @@ -476,7 +486,9 @@ in ++ optionals cfg.distributedBuilds [ pkgs.gzip ]; environment = cfg.envVars - // { CURL_CA_BUNDLE = "/etc/ssl/certs/ca-certificates.crt"; } + // { CURL_CA_BUNDLE = "/etc/ssl/certs/ca-certificates.crt"; + TMPDIR = cfg.buildLocation; + } // config.networking.proxy.envVars; unitConfig.RequiresMountsFor = "/nix/store"; @@ -490,6 +502,8 @@ in restartTriggers = [ nixConf ]; }; + systemd.tmpfiles.rules = [ "d ${cfg.buildLocation} 0775 root root -" ]; + # Set up the environment variables for running Nix. environment.sessionVariables = cfg.envVars // { NIX_PATH = cfg.nixPath; |