nix-community / poetry2nix

Convert poetry projects to nix automagically [maintainer=@adisbladis,@cpcloud]
MIT License
871 stars 447 forks source link

allow configuring platform version like extras? #1282

Open j-baker opened 1 year ago

j-baker commented 1 year ago

Hi! I'm building an application for use with nvidia jetsons.

With nVidia Jetsons, we end up with statements like

onnxruntime-gpu-tensorrt = [
   {version = "1.12.1+t234.r34.1.dev1", optional = true, markers = "platform_release == '5.10.65'"},
   {version = "1.12.1+t234.r35.1.dev1", optional = true, markers = "platform_release == '5.10.104'"},
]

which cause Poetry to pull in the appropriate version for the kernel. But, non-reproducible as it's based on the kernel version. In Nixifying this package, I'd basically like to choose the appropriate kernel version in my Nix derivation, so something like

poetry2nix.mkEnv {
   # the usual stuff
   markers = {
     platform_release = "5.10.65";
   };
};

In my head, there are 3 bugs that need solving here to make this work.

  1. poetry2nix needs to understand dependency specifications as a list, as in the example above.
  2. passing through platform releases

Would MRs for the above be appreciated?

j-baker commented 1 year ago

Alternatively, maybe it's better to use overrides for this somehow?

khaninger commented 2 months ago

I'm trying to solve a similar issue (CUDA or non-CUDA versions, switched in my flake). Groups doesnt seem suited to solving the issue, as all groups are resolved in the poetry.lock and the first matching package is pulled. Overriding extras seems like it might work, but can't find the right override for that currently. Markers would be for me the most natural way to do it, but as you point out isnt appreciated.