mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-28 02:37:09 +00:00
nix-daemon: add option to make service socket activated
This makes the service start on demand when a client connects to the daemon socket, instead of keeping it alive. services.nix-daemon.enableSocketListener = true;
This commit is contained in:
parent
a2a7e8173f
commit
27a5758728
1 changed files with 13 additions and 1 deletions
|
@ -14,6 +14,12 @@ in
|
|||
description = "Whether to enable the nix-daemon service.";
|
||||
};
|
||||
|
||||
services.nix-daemon.enableSocketListener = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Whether to make the nix-daemon service socket activated.";
|
||||
};
|
||||
|
||||
services.nix-daemon.logFile = mkOption {
|
||||
type = types.nullOr types.path;
|
||||
default = null;
|
||||
|
@ -39,13 +45,19 @@ in
|
|||
|
||||
launchd.daemons.nix-daemon = {
|
||||
command = "${config.nix.package}/bin/nix-daemon";
|
||||
serviceConfig.KeepAlive = true;
|
||||
serviceConfig.ProcessType = "Interactive";
|
||||
serviceConfig.LowPriorityIO = config.nix.daemonIONice;
|
||||
serviceConfig.Nice = config.nix.daemonNiceLevel;
|
||||
serviceConfig.SoftResourceLimits.NumberOfFiles = 4096;
|
||||
serviceConfig.StandardErrorPath = cfg.logFile;
|
||||
|
||||
serviceConfig.KeepAlive = mkIf (!cfg.enableSocketListener) true;
|
||||
|
||||
serviceConfig.Sockets = mkIf cfg.enableSocketListener
|
||||
{ Listeners.SockType = "stream";
|
||||
Listeners.SockPathName = "/nix/var/nix/daemon-socket/socket";
|
||||
};
|
||||
|
||||
serviceConfig.EnvironmentVariables = mkMerge [
|
||||
config.nix.envVars
|
||||
{ NIX_SSL_CERT_FILE = mkDefault "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";
|
||||
|
|
Loading…
Add table
Reference in a new issue