aboutsummaryrefslogtreecommitdiff
path: root/modules/services
diff options
context:
space:
mode:
Diffstat (limited to 'modules/services')
-rw-r--r--modules/services/default.nix34
1 files changed, 30 insertions, 4 deletions
diff --git a/modules/services/default.nix b/modules/services/default.nix
index 7409c59..b0d9d9a 100644
--- a/modules/services/default.nix
+++ b/modules/services/default.nix
@@ -3,11 +3,16 @@ let
cfg = config.modules.services;
inherit (lib) mkOption types listOf;
- runFile = name: value: {
+ mkService = name: value: {
${"service/" + name + "/run"} = {
text = value.run;
executable = true;
};
+ ${"service/" + name + "/log/run"} = {
+ enable = value.log != "";
+ text = value.log;
+ executable = true;
+ };
};
in
{
@@ -20,6 +25,12 @@ in
default = false;
description = "Whether to enable the user service manager module.";
};
+ coreServices = mkOption {
+ type = types.listOf types.str;
+ description = "List of services to start first";
+ example = [ "dbus" ];
+ default = [];
+ };
services = mkOption {
description = "List of user services to run on login";
type = types.attrsOf (types.submodule {
@@ -27,18 +38,33 @@ in
run = mkOption {
type = types.str;
description = "The 'run' script for the service";
- example = ''
- #!/bin/sh
+ example =
+ ''#!/bin/sh
exec chpst -e "$TURNSTILE_ENV_DIR" foo
'';
};
+ log = mkOption {
+ type = types.nullOr types.str;
+ description = "The log/run script for the service. A pipe is opened from the output of the 'run' process to this script";
+ example =
+ ''#!/bin/sh
+
+ exec vlogger -t dbus-$(id -u) -p daemon
+ '';
+ default = "";
+ };
};
});
};
};
config = lib.mkIf cfg.enable {
- xdg.configFile = (lib.concatMapAttrs runFile cfg.services);
+ xdg.configFile = (lib.concatMapAttrs mkService cfg.services)
+ // {
+ "service/turnstile-ready/conf" = {
+ text = ''core_services="${lib.strings.concatStringsSep " " cfg.coreServices}'';
+ };
+ };
};
}