summaryrefslogtreecommitdiff
path: root/overlays/nftables-prometheus-exporter/default.nix
blob: aab0c8e96029d18b354f802299e51e836624d263 (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
    '';
  };
}