{ final, prev, ... }:
let
  packageOverrides = final.callPackage ./python-packages.nix {};
  inpPython = final.python39.override { inherit packageOverrides; };
in {
  inwx-cdnskey = prev.stdenv.mkDerivation rec {
    name = "inwx-cdnskey";
    src = ./inwx-cdnskey.py;

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

    python = inpPython.withPackages (ps: with ps; [pyxdg inwx-domrobot configparser dnspython]);

    buildPhase = ''
      substituteAll $src inwx-cdnskey
    '';

    doCheck = true;
    checkPhase = ''
      ${python}/bin/python -m py_compile inwx-cdnskey
    '';

    installPhase = ''
      install -m 0755 -D -t $out/bin \
        inwx-cdnskey
    '';
  };
}