botoh/nix/module.nix

41 lines
834 B
Nix
Raw Normal View History

2024-05-14 22:31:32 -04:00
{self}: {
pkgs,
config,
lib,
...
}: let
inherit (lib) types;
inherit (lib.modules) mkIf;
inherit (lib.options) mkOption mkEnableOption;
inherit (pkgs.stdenv.hostPlatform) system;
2024-05-14 22:45:49 -04:00
cfg = config.services.botoh;
2024-05-14 22:31:32 -04:00
in {
options.services.botoh = {
enable = mkEnableOption ''
Enable botoh
'';
package = mkOption {
type = types.package;
inherit (self.packages.${system}) default;
};
2024-06-16 02:30:20 -04:00
twitch_id = mkOption {
type = types.str;
};
twitch_oauth = mkOption {
type = types.str;
};
2024-05-14 22:31:32 -04:00
};
config = mkIf cfg.enable {
2024-05-14 22:45:49 -04:00
systemd.services.botoh = {
2024-05-14 22:31:32 -04:00
wantedBy = ["multi-user.target"];
serviceConfig.ExecStart = "${cfg.package}/bin/botoh";
2024-06-16 02:30:20 -04:00
environment = {
TWITCH_ID = cfg.twitch_id;
TWITCH_OAUTH = cfg.twitch_oauth;
};
2024-05-14 22:31:32 -04:00
};
};
}