Added pkg and module for matrix-alertmanager-receiver

This commit is contained in:
fleaz 2024-03-05 23:19:38 +01:00
parent 5f38ac1616
commit 8e2c7ffa1c
No known key found for this signature in database
GPG key ID: AED15F8FDD04D083
4 changed files with 58 additions and 0 deletions

View file

@ -17,4 +17,5 @@ self: super: {
neolink = self.callPackage ./neolink { };
mealie = self.callPackage ./mealie { };
gohome = self.callPackage ./gohome { };
matrix-alertmanager-receiver = self.callPackage ./matrix-alertmanager-receiver { };
}

View file

@ -0,0 +1,19 @@
{ lib
, buildGoModule
, pkgs
, fetchFromGitHub
}:
buildGoModule rec {
pname = "matrix-alertmanager-receiver";
version = "0.1";
src = fetchFromGitHub {
owner = "fleaz";
repo = "matrix-alertmanager-receiver";
hash = "sha256-wu6vyb0Wqoi4PJ7VyIF1huu2RJ/6Rto/laLuSi9ANN0=";
rev = "v${version}";
};
vendorHash = "sha256-A1sFGSzR9SQEv92h8mVv5a1wwvzTefVJrSpk5H4fZVY=";
}

View file

@ -2,5 +2,6 @@
imports = [
#./gotosocial.nix
./mealie.nix
./matrix-alertmanager-receiver.nix
];
}

View file

@ -0,0 +1,37 @@
{ config, lib, pkgs, ...}:
let
cfg = config.services.matrix-alertmanager-receiver;
in
{
options.services.matrix-alertmanager-receiver = {
enable = lib.mkEnableOption "matrix-alertmanager-receiver, a Matrix bridge for Alertmanager webhooks";
configFile = lib.mkOption {
type = lib.types.path;
default = "";
example = "/run/secrets/matrix-alertmanager-receiver.toml";
description = ''
The TOML config file
'';
};
};
config = lib.mkIf cfg.enable {
systemd.services.matrix-alertmanager-receiver = {
description = "Matrix bridge for Alertmanager webhooks";
after = [
"network.target"
"network-online.target"
];
wantedBy = [
"multi-user.target"
];
serviceConfig = {
DynamicUser = true;
User = "matrix-alertmanager-receiver";
ExecStart = "${pkgs.matrix-alertmanager-receiver}/bin/matrix-alertmanager-receiver -config ${cfg.configFile}";
};
};
};
}