61 lines
1.7 KiB
Nix
61 lines
1.7 KiB
Nix
{
|
|
description = "Relay prometheus alerts to ntfy.sh";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
flake-compat = {
|
|
url = "github:edolstra/flake-compat";
|
|
flake = false;
|
|
};
|
|
};
|
|
|
|
outputs = { nixpkgs, flake-utils, self, ... }: {
|
|
nixosModules.default = ({ pkgs, ... }: {
|
|
imports = [ ./module.nix ];
|
|
# defined overlays injected by the nixflake
|
|
nixpkgs.overlays = [
|
|
(_self: _super: {
|
|
alertmanager-ntfy = self.packages.${pkgs.system}.alertmanager-ntfy;
|
|
})
|
|
];
|
|
});
|
|
} //
|
|
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let pkgs = nixpkgs.legacyPackages.${system};
|
|
in rec {
|
|
packages = flake-utils.lib.flattenTree rec {
|
|
|
|
default = alertmanager-ntfy;
|
|
|
|
alertmanager-ntfy = pkgs.buildGoModule rec {
|
|
|
|
pname = "alertmanager-ntfy";
|
|
version = "1.0.0";
|
|
|
|
src = ./.;
|
|
vendorHash = "sha256-Ezt1HDxGQ7DePF90HgHKkH7v365ICFdnfcWJipLhCwQ=";
|
|
|
|
meta = with pkgs.lib; {
|
|
description = "Relay prometheus alerts to ntfy";
|
|
homepage = "https://github.com/pinpox/alertmanager-ntfy";
|
|
license = licenses.gpl3;
|
|
maintainers = with maintainers; [ pinpox ];
|
|
};
|
|
};
|
|
|
|
mock-hook = pkgs.writeScriptBin "mock-hook" ''
|
|
#!${pkgs.stdenv.shell}
|
|
${pkgs.curl}/bin/curl -X POST -d @mock.json http://$HTTP_ADDRESS:$HTTP_PORT
|
|
'';
|
|
};
|
|
|
|
apps = rec {
|
|
mock-hook = flake-utils.lib.mkApp { drv = packages.mock-hook; };
|
|
alertmanager-ntfy = flake-utils.lib.mkApp { drv = packages.alertmanager-ntfy; };
|
|
defulat = alertmanager-ntfy;
|
|
};
|
|
|
|
});
|
|
}
|