diff options
| author | Stefan Weigl-Bosker <stefan@s00.xyz> | 2025-03-04 12:36:18 -0500 |
|---|---|---|
| committer | Stefan Weigl-Bosker <stefan@s00.xyz> | 2025-03-04 12:36:18 -0500 |
| commit | fdbeca13108fac5e5f07fb08d8b28d80ed973c1d (patch) | |
| tree | a656d95b58ee4502cb5fc5cc834a7f42d74a771d /modules/services | |
| parent | cfd09f66cbd48d527f1b9ab02aec2420d3fd7ab8 (diff) | |
| download | home-fdbeca13108fac5e5f07fb08d8b28d80ed973c1d.tar.gz | |
service management wip
Diffstat (limited to 'modules/services')
| -rw-r--r-- | modules/services/default.nix | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/modules/services/default.nix b/modules/services/default.nix new file mode 100644 index 0000000..7409c59 --- /dev/null +++ b/modules/services/default.nix @@ -0,0 +1,44 @@ +{ self, config, lib, pkgs, nixgl, ... }: +let + cfg = config.modules.services; + + inherit (lib) mkOption types listOf; + runFile = name: value: { + ${"service/" + name + "/run"} = { + text = value.run; + executable = true; + }; + }; +in +{ + options.modules.services = { + name = mkOption { + type = types.string; + }; + enable = mkOption { + type = types.bool; + default = false; + description = "Whether to enable the user service manager module."; + }; + services = mkOption { + description = "List of user services to run on login"; + type = types.attrsOf (types.submodule { + options = { + run = mkOption { + type = types.str; + description = "The 'run' script for the service"; + example = '' + #!/bin/sh + + exec chpst -e "$TURNSTILE_ENV_DIR" foo + ''; + }; + }; + }); + }; + }; + + config = lib.mkIf cfg.enable { + xdg.configFile = (lib.concatMapAttrs runFile cfg.services); + }; +} |