From b68afa8569dc3fac0f54bd300da93916fdb5715a Mon Sep 17 00:00:00 2001 From: Aaron Jheng Date: Fri, 7 Oct 2022 03:10:46 +0000 Subject: [PATCH] prometheus-postfix-exporter: 0.1.2 -> 0.3.0 --- .../prometheus/postfix-exporter-deps.nix | 66 ------------------- .../prometheus/postfix-exporter.nix | 54 ++++++--------- 2 files changed, 19 insertions(+), 101 deletions(-) delete mode 100644 pkgs/servers/monitoring/prometheus/postfix-exporter-deps.nix diff --git a/pkgs/servers/monitoring/prometheus/postfix-exporter-deps.nix b/pkgs/servers/monitoring/prometheus/postfix-exporter-deps.nix deleted file mode 100644 index 07bedaba9f36..000000000000 --- a/pkgs/servers/monitoring/prometheus/postfix-exporter-deps.nix +++ /dev/null @@ -1,66 +0,0 @@ -# This file was generated by https://github.com/kamilchm/go2nix v1.2.1 -[ - { - goPackagePath = "github.com/beorn7/perks"; - fetch = { - type = "git"; - url = "https://github.com/beorn7/perks"; - rev = "3a771d992973f24aa725d07868b467d1ddfceafb"; - sha256 = "1l2lns4f5jabp61201sh88zf3b0q793w4zdgp9nll7mmfcxxjif3"; - }; - } - { - goPackagePath = "github.com/golang/protobuf"; - fetch = { - type = "git"; - url = "https://github.com/golang/protobuf"; - rev = "b4deda0973fb4c70b50d226b1af49f3da59f5265"; - sha256 = "0ya4ha7m20bw048m1159ppqzlvda4x0vdprlbk5sdgmy74h3xcdq"; - }; - } - { - goPackagePath = "github.com/matttproud/golang_protobuf_extensions"; - fetch = { - type = "git"; - url = "https://github.com/matttproud/golang_protobuf_extensions"; - rev = "c12348ce28de40eed0136aa2b644d0ee0650e56c"; - sha256 = "1d0c1isd2lk9pnfq2nk0aih356j30k3h1gi2w0ixsivi5csl7jya"; - }; - } - { - goPackagePath = "github.com/prometheus/client_golang"; - fetch = { - type = "git"; - url = "https://github.com/prometheus/client_golang"; - rev = "82f5ff156b29e276022b1a958f7d385870fb9814"; - sha256 = "111j329yrlgvh73dm80gawwxsh9dgjkw74254kyj5c2rfmra7znz"; - }; - } - { - goPackagePath = "github.com/prometheus/client_model"; - fetch = { - type = "git"; - url = "https://github.com/prometheus/client_model"; - rev = "99fa1f4be8e564e8a6b613da7fa6f46c9edafc6c"; - sha256 = "19y4ywsivhpxj7ikf2j0gm9k3cmyw37qcbfi78n526jxcc7kw998"; - }; - } - { - goPackagePath = "github.com/prometheus/common"; - fetch = { - type = "git"; - url = "https://github.com/prometheus/common"; - rev = "d811d2e9bf898806ecfb6ef6296774b13ffc314c"; - sha256 = "0r4067r4ysmljksqw3awcxx5qplqhykahc5igdzgkky7i4bvaik1"; - }; - } - { - goPackagePath = "github.com/prometheus/procfs"; - fetch = { - type = "git"; - url = "https://github.com/prometheus/procfs"; - rev = "8b1c2da0d56deffdbb9e48d4414b4e674bd8083e"; - sha256 = "0x128p15h35mgwqxkigfkk1lfrcz9g697ahl8v6xp9kwvcqvjrrf"; - }; - } -] diff --git a/pkgs/servers/monitoring/prometheus/postfix-exporter.nix b/pkgs/servers/monitoring/prometheus/postfix-exporter.nix index 8f71c0123dce..a34695452dc8 100644 --- a/pkgs/servers/monitoring/prometheus/postfix-exporter.nix +++ b/pkgs/servers/monitoring/prometheus/postfix-exporter.nix @@ -1,55 +1,39 @@ -{ lib, buildGoPackage, fetchFromGitHub, makeWrapper, nixosTests -, systemd, withSystemdSupport ? true }: +{ lib +, buildGoModule +, fetchFromGitHub +, makeWrapper +, nixosTests +, systemd +, withSystemdSupport ? true +}: -with lib; - -buildGoPackage rec { +buildGoModule rec { pname = "postfix_exporter"; - version = "0.1.2"; - - goPackagePath = "github.com/kumina/postfix_exporter"; + version = "0.3.0"; src = fetchFromGitHub { owner = "kumina"; repo = "postfix_exporter"; rev = version; - sha256 = "1b9ib3scxni6hlw55wv6f0z1xfn27l0p29as24f71rs70pyzy4hm"; + sha256 = "sha256-63ze51Qbjm+3CV1OFGFa9cS4ucZ+gMKaJyBF2b//CfM="; }; - nativeBuildInputs = optional withSystemdSupport makeWrapper; - buildInputs = optional withSystemdSupport systemd; - tags = optional (!withSystemdSupport) "nosystemd"; + vendorSha256 = "sha256-a4Lk4wh4mvXEjLgFksZIVVtbp+zTUyjtLVuk7vuot2k="; - goDeps = ./postfix-exporter-deps.nix; - extraSrcs = optionals withSystemdSupport [ - { - goPackagePath = "github.com/coreos/go-systemd"; - src = fetchFromGitHub { - owner = "coreos"; - repo = "go-systemd"; - rev = "d1b7d058aa2adfc795ad17ff4aaa2bc64ec11c78"; - sha256 = "1nz3v1b90hnmj2vjjwq96pr6psxlndqjyd30v9sgiwygzb7db9mv"; - }; - } - { - goPackagePath = "github.com/coreos/pkg"; - src = fetchFromGitHub { - owner = "coreos"; - repo = "pkg"; - rev = "97fdf19511ea361ae1c100dd393cc47f8dcfa1e1"; - sha256 = "1srn87wih25l09f75483hnxsr8fc6rq3bk7w1x8125ym39p6mg21"; - }; - } - ]; + ldflags = [ "-s" "-w" ]; - postInstall = optionalString withSystemdSupport '' + 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 = { + meta = with lib; { inherit (src.meta) homepage; description = "A Prometheus exporter for Postfix"; license = licenses.asl20;