summaryrefslogtreecommitdiff
path: root/flake.nix
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2024-08-01 19:13:16 -0400
committerLLLL Colonq <llll@colonq>2024-08-01 19:13:16 -0400
commit3a795b76a703a048529313ea45e323da82f66d34 (patch)
tree7ca774841bd8780e99b0914fcd6cac09b1a6d9eb /flake.nix
parent7ffb7b021eec46f2d714e04b47d752012e1bf8ea (diff)
Add Twitch live monitor
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix46
1 files changed, 46 insertions, 0 deletions
diff --git a/flake.nix b/flake.nix
index 7012071..5ab5b90 100644
--- a/flake.nix
+++ b/flake.nix
@@ -93,6 +93,51 @@
};
};
};
+ figMonitorTwitchLiveWatcherModule = { config, lib, ... }:
+ let
+ cfg = config.colonq.services.fig-monitor-twitch-live-watcher;
+ in {
+ options.colonq.services.fig-monitor-twitch-live-watcher = {
+ enable = lib.mkEnableOption "Enable the fig Twitch live watcher";
+ busHost = lib.mkOption {
+ type = lib.types.str;
+ default = "127.0.0.1";
+ description = "Message bus port";
+ };
+ busPort = lib.mkOption {
+ type = lib.types.port;
+ default = 32050;
+ description = "Address of message bus";
+ };
+ configFile = lib.mkOption {
+ type = lib.types.path;
+ description = "Path to config file";
+ default = pkgs.writeText "fig-monitor-twitch.toml" ''
+ client_id = ""
+ user_token = ""
+ user_login = ""
+ monitor = []
+ '';
+ };
+ };
+ config = lib.mkIf cfg.enable {
+ systemd.services."colonq.fig-monitor-twitch-live-watcher" = {
+ wantedBy = ["multi-user.target"];
+ after = ["colonq.fig-bus.service"];
+ serviceConfig = {
+ Restart = "on-failure";
+ ExecStart = "${haskellPackages.fig-monitor-twitch-live-watcher}/bin/fig-monitor-twitch live-checker --bus-host ${cfg.busHost} --bus-port ${toString cfg.busPort} --config ${cfg.configFile}";
+ DynamicUser = "yes";
+ RuntimeDirectory = "colonq.fig-monitor-twitch-live-watcher";
+ RuntimeDirectoryMode = "0755";
+ StateDirectory = "colonq.fig-monitor-twitch-live-watcher";
+ StateDirectoryMode = "0700";
+ CacheDirectory = "colonq.fig-monitor-twitch-live-watcher";
+ CacheDirectoryMode = "0750";
+ };
+ };
+ };
+ };
figMonitorDiscordModule = { config, lib, ... }:
let
cfg = config.colonq.services.fig-monitor-discord;
@@ -293,6 +338,7 @@
];
withHoogle = true;
buildInputs = [
+ haskellPackages.cabal-install
haskellPackages.haskell-language-server
pkgs.nodejs
(purescript.command {})