{ config, lib, pkgs, ... }: let cfg = config.bagel.services.alertmanager-hookshot-adapter; inherit (lib) mkEnableOption mkIf; package = pkgs.callPackage ./package.nix {}; in { options.bagel.services.alertmanager-hookshot-adapter.enable = mkEnableOption "alertmanager to matrix-hookshot adapter"; config = mkIf cfg.enable { systemd.services.alertmanager-hookshot-adapter = { wantedBy = ["multi-user.target"]; wants = ["network-online.target"]; after = ["network-online.target"]; environment = { PORT = "9100"; UPSTREAM = "https://alerts.forkos.org/webhook"; }; serviceConfig = { ExecStart = lib.getExe package; DynamicUser = true; }; }; }; }