aboutsummaryrefslogtreecommitdiff
path: root/modules/services/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'modules/services/default.nix')
-rw-r--r--modules/services/default.nix44
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);
+ };
+}