Add module

This commit is contained in:
clerie 2023-02-06 13:29:34 +01:00
parent 085001fb5c
commit 79730bd7df
1 changed files with 63 additions and 0 deletions

View File

@ -37,6 +37,69 @@
default = self.apps.x86_64-linux.solid-xmpp-alarm;
};
nixosModules = {
solid-xmpp-alarm = { config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.solid-xmpp-alarm;
in {
options = {
services.solid-xmpp-alarm = {
enable = mkEnableOption "Prometheus Alertmanager webhook receiver for XMPP clients";
jid = mkOption {
type = types.str;
description = ''
XMPP account name of the sender.
'';
};
passwordFile = mkOption {
type = types.path;
description = ''
Path to file containing the password to log into the senders account.
'';
};
receiver = mkOption {
type = types.str;
description = ''
XMPP account name of the receiver.
'';
};
package = mkOption {
type = types.package;
default = self.packages.${config.nixpkgs.system}.solid-xmpp-alarm;
description = ''
Specify a custom solid-xmpp-alarm package. By default use the one shipped with this flake.
'';
};
};
};
config = mkIf cfg.enable {
users.users."solid-xmpp-alarm" = {
isSystemUser = true;
group = "solid-xmpp-alarm";
};
users.groups."solid-xmpp-alarm" = {};
systemd.services."solid-xmpp-alarm" = {
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
Restart = "always";
PrivateTmp = true;
WorkingDirectory = "/tmp";
RuntimeDirectory = "solid-xmpp-alarm";
User = "solid-xmpp-alarm";
Group = "solid-xmpp-alarm";
ExecStart = ''
${cfg.package}/bin/solid-xmpp-alarm --jid ${cfg.jid} --password-file ${cfg.passwordFile} --receiver ${cfg.receiver}
'';
};
};
};
};
};
hydraJobs = {
inherit (self)
packages;