summaryrefslogtreecommitdiff
path: root/overlays/nftables-prometheus-exporter/default.nix
blob: 48f668c4cf4e94e86679b76ad2e72488f1e7971d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
{ final, prev, ... }:
let
  inpPython = final.python310;
  python = inpPython.withPackages (ps: with ps; []);
in {
  nftables-prometheus-exporter = prev.stdenv.mkDerivation rec {
    name = "nftables-prometheus-exporter";
    src = prev.replaceVars ./nftables-prometheus-exporter.py { inherit python; };

    phases = [ "unpackPhase" "checkPhase" "installPhase" ];

    unpackPhase = ''
      cp $src nftables-prometheus-exporter
    '';

    doCheck = true;
    checkPhase = ''
      ${python}/bin/python -m py_compile nftables-prometheus-exporter
    '';

    installPhase = ''
      install -m 0755 -D -t $out/bin \
        nftables-prometheus-exporter
    '';
  };
}