Added pkg and module for matrix-alertmanager-receiver
This commit is contained in:
parent
5f38ac1616
commit
8e2c7ffa1c
|
@ -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 { };
|
||||
}
|
||||
|
|
19
matrix-alertmanager-receiver/default.nix
Normal file
19
matrix-alertmanager-receiver/default.nix
Normal 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=";
|
||||
}
|
|
@ -2,5 +2,6 @@
|
|||
imports = [
|
||||
#./gotosocial.nix
|
||||
./mealie.nix
|
||||
./matrix-alertmanager-receiver.nix
|
||||
];
|
||||
}
|
||||
|
|
37
modules/matrix-alertmanager-receiver.nix
Normal file
37
modules/matrix-alertmanager-receiver.nix
Normal 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}";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue