summaryrefslogtreecommitdiff
path: root/overlays/nftables-prometheus-exporter/default.nix
blob: 452f160fad95c5981a836c44c730c119f5ff1fee (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
27
final: prev:
let
  inpPython = final.python310;
in {
  nftables-prometheus-exporter = prev.stdenv.mkDerivation rec {
    name = "nftables-prometheus-exporter";
    src = ./nftables-prometheus-exporter.py;

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

    python = inpPython.withPackages (ps: with ps; []);

    buildPhase = ''
      substituteAll $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
    '';
  };
}