about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/monitoring/prometheus/postfix-exporter.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/monitoring/prometheus/postfix-exporter.nix')
-rw-r--r--nixpkgs/pkgs/servers/monitoring/prometheus/postfix-exporter.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/monitoring/prometheus/postfix-exporter.nix b/nixpkgs/pkgs/servers/monitoring/prometheus/postfix-exporter.nix
new file mode 100644
index 000000000000..ad85dfb73318
--- /dev/null
+++ b/nixpkgs/pkgs/servers/monitoring/prometheus/postfix-exporter.nix
@@ -0,0 +1,43 @@
+{ lib
+, buildGoModule
+, fetchFromGitHub
+, makeWrapper
+, nixosTests
+, systemd
+, withSystemdSupport ? true
+}:
+
+buildGoModule rec {
+  pname = "postfix_exporter";
+  version = "0.3.0";
+
+  src = fetchFromGitHub {
+    owner = "kumina";
+    repo = "postfix_exporter";
+    rev = version;
+    sha256 = "sha256-63ze51Qbjm+3CV1OFGFa9cS4ucZ+gMKaJyBF2b//CfM=";
+  };
+
+  vendorHash = "sha256-a4Lk4wh4mvXEjLgFksZIVVtbp+zTUyjtLVuk7vuot2k=";
+
+  ldflags = [ "-s" "-w" ];
+
+  nativeBuildInputs = lib.optionals withSystemdSupport [ makeWrapper ];
+  buildInputs = lib.optionals withSystemdSupport [ systemd ];
+  tags = lib.optionals (!withSystemdSupport) "nosystemd";
+
+  postInstall = lib.optionals withSystemdSupport ''
+    wrapProgram $out/bin/postfix_exporter \
+      --prefix LD_LIBRARY_PATH : "${lib.getLib systemd}/lib"
+  '';
+
+  passthru.tests = { inherit (nixosTests.prometheus-exporters) postfix; };
+
+  meta = with lib; {
+    inherit (src.meta) homepage;
+    description = "A Prometheus exporter for Postfix";
+    mainProgram = "postfix_exporter";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ willibutz globin ];
+  };
+}