diff --git a/nix/hm-module.nix b/nix/hm-module.nix index e5de8485..a12a6432 100644 --- a/nix/hm-module.nix +++ b/nix/hm-module.nix @@ -109,6 +109,16 @@ in { Enable systemd integration. ''; }; + + systemd.defines = mkOption { + type = types.attrsOf types.str; + default = {}; + description = "defines for the systemd module. Will be passed into the ags service's ExecStart."; + example = { + DEBUG = "true"; + RUNTIME = "\\'systemd\\'"; + }; + }; }; config = mkIf cfg.enable (mkMerge [ @@ -139,7 +149,12 @@ in { }; Service = { - ExecStart = "${cfg.finalPackage}/bin/ags run"; + ExecStart = let + defines = + lib.concatStringsSep " " + (lib.mapAttrsToList (key: value: "--define ${key}=${toString value}") cfg.systemd.defines); + in + "${cfg.finalPackage}/bin/ags run " + defines; Restart = "on-failure"; KillMode = "mixed"; };