Help building pdm based Python package

I’m trying to build the mkdocs-autoref package from Pypi using the following:

{ lib, pdm, python39Packages}:

with python39Packages; buildPythonPackage rec {
  pname = "mkdocs-autorefs";
  version = "0.4.1";
  format = "pyproject";

  src = fetchPypi {
    inherit pname version;
    sha256 = "sha256-cHSKe9Al+ezW1v7rqLpj+OiRoa9V9I42bW1ueEk6uoQ=";
  };

  nativeBuildInputs = [ pdm ];
  propagatedBuildInputs = [
    markdown mkdocs
  ];

  doCheck = false;

  meta = with lib; {
    homepage = "https://github.com/mkdocstrings/autorefs";
    description = "Automatically link across pages in MkDocs.";
    license = licenses.isc;
  };
}

Attempting to build results in:

building the system configuration...
error: builder for '/nix/store/bk7avaszfcj8q0ivlxg41hicz7zs50w5-pdm-1.12.6.drv' failed with exit code 1;
       last 10 log lines:
       > Requirement already satisfied: python-dotenv>=0.15 in /nix/store/wdh4ra7rs2n3kkhkdgwng7xz669j68c2-python3.9-python-dotenv-0.19.2/lib/python3.9/site-packages (from pdm==1.12.6) (0.19.2)
       > Requirement already satisfied: pep517>=0.11.0 in /nix/store/6hydkalfcyw78xan9sfxyaji96g31s55-python3.9-pep517-0.12.0/lib/python3.9/site-packages (from pdm==1.12.6) (0.12.0)
       > Requirement already satisfied: tomlkit<1,>=0.8.0 in /nix/store/h9lxrvjc7r4xpgrizsa6wspxj4vc8ydy-python3.9-tomlkit-0.8.0/lib/python3.9/site-packages (from pdm==1.12.6) (0.8.0)
       > Requirement already satisfied: resolvelib<0.9,>=0.8 in /nix/store/dv1pi45zgd2k9pn43wy2v6i82bv6183k-python3.9-resolvelib-0.8.1/lib/python3.9/site-packages (from pdm==1.12.6) (0.8.1)
       > Requirement already satisfied: click>=7 in /nix/store/yqzgpqsc7hq4icgvyzqldbihyd6b5rj1-python3.9-click-8.0.3/lib/python3.9/site-packages (from pdm==1.12.6) (8.0.3)
       > Requirement already satisfied: pip>=20.1 in /nix/store/cdxfdpy2bi49y7wzh6n8h93cyplnanrm-python3.9-pip-21.3.1/lib/python3.9/site-packages (from pdm==1.12.6) (21.3.1)
       > Requirement already satisfied: tomli>=1.1.0 in /nix/store/28vyi1khfqzic6hnypk6b80b69qz84qs-python3.9-tomli-1.2.2/lib/python3.9/site-packages (from pdm==1.12.6) (1.2.2)
       > Requirement already satisfied: installer~=0.3.0 in /nix/store/rvpj5ckb48lm33zyk6vlq8g213g7w9hq-python3.9-installer-0.3.0/lib/python3.9/site-packages (from pdm==1.12.6) (0.3.0)
       > ERROR: Could not find a version that satisfies the requirement pdm-pep517<0.10,>=0.9 (from pdm) (from versions: none)
       > ERROR: No matching distribution found for pdm-pep517<0.10,>=0.9
       For full logs, run 'nix log /nix/store/bk7avaszfcj8q0ivlxg41hicz7zs50w5-pdm-1.12.6.drv'.
error: 1 dependencies of derivation '/nix/store/ks0b2dgq41g2ijswcpkf84wbcwkk636r-python3.9-mkdocs-autorefs-0.4.1.drv' failed to build

It appears there’s a patch in the pdm nix package that limits pdm-pep517 to the string seen above. However, it looks like the current pdm-pep57 nix package is at v0.10.2.

How can I reconcile this conflict?

this isn’t the same as pdm, which is a separate package.

You can “steal” my packaging of this on https://github.com/NixOS/nixpkgs/pull/145528/commits/e3383a26f40b41fd131e91fb1db2b8bb9cddd156