{ description = "Relay Prometheus alerts to ntfy.sh"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; flake-utils.url = "github:numtide/flake-utils"; flake-compat = { url = "github:edolstra/flake-compat"; flake = false; }; }; outputs = { self, nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system: let pkgs = nixpkgs.legacyPackages.${system}; goModule = import ./default.nix; name = "alertmanager-ntfy"; version = "1.0.0"; in { packages = rec { alertmanager-ntfy = goModule; container = pkgs.dockerTools.buildImage { inherit name; tag = version; created = "now"; copyToRoot = pkgs.buildEnv { name = "root-env"; paths = [ alertmanager-ntfy ]; }; config.Cmd = [ "${alertmanager-ntfy}/bin/alertmanager-ntfy" ]; }; 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 = self.packages.${system}.mock-hook; }; alertmanager-ntfy = flake-utils.lib.mkApp { drv = self.packages.${system}.alertmanager-ntfy; }; default = alertmanager-ntfy; }; nixosModules.default = ({ pkgs, ... }: { imports = [ ./module.nix ]; nixpkgs.overlays = [ (self: super: { alertmanager-ntfy = self.packages.${system}.alertmanager-ntfy; }) ]; }); } ); }