1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00
nix-darwin/modules/services/nix-daemon.nix

56 lines
1.3 KiB
Nix
Raw Normal View History

2016-12-04 09:44:58 +00:00
{ 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 {
2016-12-04 09:44:58 +00:00
2016-12-15 12:26:22 +00:00
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 = {
2017-01-25 20:22:40 +00:00
command = "${config.nix.package}/bin/nix-daemon";
2016-12-04 09:44:58 +00:00
serviceConfig.KeepAlive = true;
serviceConfig.ProcessType = "Interactive";
2016-12-15 12:26:22 +00:00
serviceConfig.LowPriorityIO = config.nix.daemonIONice;
serviceConfig.Nice = config.nix.daemonNiceLevel;
2016-12-04 09:44:58 +00:00
serviceConfig.SoftResourceLimits.NumberOfFiles = 4096;
2016-12-15 12:26:22 +00:00
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"; }
2016-12-15 12:26:22 +00:00
// { TMPDIR = "${cfg.tempDir}"; };
};
2017-01-25 20:22:40 +00:00
2016-12-04 09:44:58 +00:00
};
}