{ 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
    '';
  };
}