summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorWael M. Nasreddine <wael@keeptruckin.com>2020-04-14 14:53:31 -0700
committerWael M. Nasreddine <wael.nasreddine@gmail.com>2020-04-14 15:01:37 -0700
commitcee84f4ea04d0ce3a6dc1f2c34d09a0ae5beed95 (patch)
tree218fe513d6e572e26bc5655e30d4a627b795bca0 /modules
parent053f2cb9cb0ce7ceb4933cbd76e2d28713ad85da (diff)
launchd: allow customization of the default launchd prefix
Diffstat (limited to 'modules')
-rw-r--r--modules/launchd/default.nix11
-rw-r--r--modules/services/nix-daemon.nix1
2 files changed, 11 insertions, 1 deletions
diff --git a/modules/launchd/default.nix b/modules/launchd/default.nix
index cbcac9c..f82df2a 100644
--- a/modules/launchd/default.nix
+++ b/modules/launchd/default.nix
@@ -88,7 +88,7 @@ let
${config.script}
'');
- serviceConfig.Label = mkDefault "org.nixos.${name}";
+ serviceConfig.Label = mkDefault "${cfg.labelPrefix}.${name}";
serviceConfig.ProgramArguments = mkIf (cmd != "") [ "/bin/sh" "-c" "exec ${cmd}" ];
serviceConfig.EnvironmentVariables = mkIf (env != {}) env;
};
@@ -97,6 +97,15 @@ in
{
options = {
+ launchd.labelPrefix = mkOption {
+ type = types.str;
+ default = "org.nixos";
+ description = ''
+ The default prefix of the service label. Individual services can
+ override this by setting the Label attribute.
+ '';
+ };
+
launchd.envVariables = mkOption {
type = types.attrsOf (types.either types.str (types.listOf types.str));
default = {};
diff --git a/modules/services/nix-daemon.nix b/modules/services/nix-daemon.nix
index 0e4909d..735d92c 100644
--- a/modules/services/nix-daemon.nix
+++ b/modules/services/nix-daemon.nix
@@ -51,6 +51,7 @@ in
serviceConfig.ProcessType = mkDefault "Interactive";
serviceConfig.LowPriorityIO = config.nix.daemonIONice;
serviceConfig.Nice = config.nix.daemonNiceLevel;
+ serviceConfig.Label = "org.nixos.nix-daemon"; # must match daemon installed by Nix regardless of the launchd label Prefix
serviceConfig.SoftResourceLimits.NumberOfFiles = mkDefault 4096;
serviceConfig.StandardErrorPath = cfg.logFile;