mirror of
https://github.com/LnL7/nix-darwin.git
synced 2024-12-14 11:57:34 +00:00
add nix-daemon service module
This commit is contained in:
parent
7b3ace08c5
commit
1ab74daf82
2 changed files with 61 additions and 12 deletions
16
config.nix
16
config.nix
|
@ -15,6 +15,7 @@ let
|
|||
./modules/environment
|
||||
./modules/launchd
|
||||
./modules/services/activate-system.nix
|
||||
./modules/services/nix-daemon.nix
|
||||
./modules/programs/tmux.nix
|
||||
];
|
||||
};
|
||||
|
@ -37,19 +38,10 @@ let
|
|||
pkgs.nox
|
||||
];
|
||||
|
||||
services.activate-system.enable = true;
|
||||
services.nix-daemon.enable = true;
|
||||
services.nix-daemon.tempDir = "/nix/tmp";
|
||||
|
||||
launchd.daemons.nix-daemon =
|
||||
{ serviceConfig.Program = "/nix/var/nix/profiles/default/bin/nix-daemon";
|
||||
serviceConfig.KeepAlive = true;
|
||||
serviceConfig.ProcessType = "Background";
|
||||
serviceConfig.SoftResourceLimits.NumberOfFiles = 4096;
|
||||
serviceConfig.EnvironmentVariables.TMPDIR = "/nix/tmp";
|
||||
serviceConfig.EnvironmentVariables.SSL_CERT_FILE = "/nix/var/nix/profiles/default/etc/ssl/certs/ca-bundle.crt";
|
||||
serviceConfig.EnvironmentVariables.NIX_BUILD_HOOK="/nix/var/nix/profiles/default/libexec/nix/build-remote.pl";
|
||||
serviceConfig.EnvironmentVariables.NIX_CURRENT_LOAD="/nix/tmp/current-load";
|
||||
serviceConfig.EnvironmentVariables.NIX_REMOTE_SYSTEMS="/etc/nix/machines";
|
||||
};
|
||||
services.activate-system.enable = true;
|
||||
|
||||
system.defaults.global.InitialKeyRepeat = 10;
|
||||
system.defaults.global.KeyRepeat = 1;
|
||||
|
|
57
modules/services/nix-daemon.nix
Normal file
57
modules/services/nix-daemon.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{ 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.";
|
||||
};
|
||||
|
||||
profile = mkOption {
|
||||
type = types.path;
|
||||
default = "/nix/var/nix/profiles/default";
|
||||
description = "Profile to use for nix and cacert.";
|
||||
};
|
||||
|
||||
buildMachinesFile = mkOption {
|
||||
type = types.path;
|
||||
default = "/etc/nix/machines";
|
||||
description = "File containing build machines.";
|
||||
};
|
||||
|
||||
tempDir = mkOption {
|
||||
type = types.path;
|
||||
default = "/tmp";
|
||||
description = "The TMPDIR to use for nix-daemon.";
|
||||
};
|
||||
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
|
||||
launchd.daemons.nix-daemon = mkIf cfg.enable {
|
||||
serviceConfig.Program = "${cfg.profile}/bin/nix-daemon";
|
||||
serviceConfig.KeepAlive = true;
|
||||
serviceConfig.ProcessType = "Background";
|
||||
serviceConfig.SoftResourceLimits.NumberOfFiles = 4096;
|
||||
serviceConfig.EnvironmentVariables.TMPDIR = "${cfg.tempDir}";
|
||||
serviceConfig.EnvironmentVariables.SSL_CERT_FILE = "${cfg.profile}/etc/ssl/certs/ca-bundle.crt";
|
||||
serviceConfig.EnvironmentVariables.NIX_BUILD_HOOK="${cfg.profile}/libexec/nix/build-remote.pl";
|
||||
serviceConfig.EnvironmentVariables.NIX_CURRENT_LOAD="${cfg.tempDir}/current-load";
|
||||
serviceConfig.EnvironmentVariables.NIX_REMOTE_SYSTEMS="${cfg.buildMachinesFile}";
|
||||
};
|
||||
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue