Skip to content

Commit

Permalink
pdm: support additional index/source URLs
Browse files Browse the repository at this point in the history
pdm supports extra indexes in tool.pdm.source blocks and we can also
pass a list of urls to fetchFromLegacy, so this aggregates URLs from
the source blocks and passes them.

I think this will unblock simple cases like getting a package that is
not on pypi.org from some other index, but I imagine that there are
more complex cases that will require refining this support.
  • Loading branch information
abathur committed Jun 28, 2024
1 parent 4d44182 commit 677270e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/dream2nix/WIP-python-pdm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -192,12 +192,15 @@ in {
else null
);
mkDerivation = {
# TODO: handle sources outside pypi.org
src = lib.mkDefault (libpyproject-fetchers.fetchFromLegacy {
pname = name;
file = source.file;
hash = source.hash;
url = "https://pypi.org/simple";
urls =
[
"https://pypi.org/simple"
]
++ lib.optionals (lib.hasAttrByPath ["tool" "pdm" "source"] pyproject.pyproject) (builtins.map (source: source.url) pyproject.pyproject.tool.pdm.source);
});
propagatedBuildInputs =
lib.mapAttrsToList
Expand Down

0 comments on commit 677270e

Please sign in to comment.