blob: 7b42fc62c2d48cd3e81385bde1698f3c66618ffe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.nix-daemon;
in
{
options = {
services.nix-daemon = {
enable = mkOption {
type = types.bool;
default = false;
description = "Whether to activate system at boot time.";
};
tempDir = mkOption {
type = types.path;
default = "/tmp";
description = "The TMPDIR to use for nix-daemon.";
};
};
};
config = mkIf cfg.enable {
environment.extraInit = ''
# Set up secure multi-user builds: non-root users build through the
# Nix daemon.
if [ "$USER" != root -o ! -w /nix/var/nix/db ]; then
export NIX_REMOTE=daemon
fi
'';
launchd.daemons.nix-daemon = {
command = "${config.nix.package}/bin/nix-daemon";
serviceConfig.KeepAlive = true;
serviceConfig.ProcessType = "Background";
serviceConfig.LowPriorityIO = config.nix.daemonIONice;
serviceConfig.Nice = config.nix.daemonNiceLevel;
serviceConfig.SoftResourceLimits.NumberOfFiles = 4096;
serviceConfig.EnvironmentVariables = config.nix.envVars
# // { CURL_CA_BUNDLE = "/etc/ssl/certs/ca-certificates.crt"; }
// { SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; }
// { TMPDIR = "${cfg.tempDir}"; };
};
};
}
|