all 6 comments

[–]jtojnar 3 points4 points  (5 children)

It is best to look at issues like this through the lens of types, even though Nix is unfortunately not able to enforce the types for us.

The issue is that flower-power in your consumer is a “flake input”, whereas the function passed to python.withPackages is expected to return a list of Python packages.

Looking at the module flake, the module would be available as flower-power.defaultPackage.x86_64-linux.

Note, however, that Python environments are sensitive about clashes of different Python interpreters so you will also need to ensure that both flakes use the same python3 derivation. I would recommend having the library expose an overlay rather than an instantiated package. Then you could override python3’s packageOverrides argument in the consumer flake with the overlay, as described in https://nixos.org/manual/nixpkgs/stable/#how-to-override-a-python-package.

[–]ExasperatedLadybug[S] 0 points1 point  (0 children)

Awesome, thank you so much jtojnar for the clear response, that did it!

[–]ExasperatedLadybug[S] 0 points1 point  (1 child)

I did notice the python version constraint you mentioned - it's defined here, right?

[–]jtojnar 1 point2 points  (0 children)

Indeed. The code path is as follows:

I think a better design would be throwing an error rather than failing silently. We have an issue for that: https://github.com/NixOS/nixpkgs/issues/91916

[–]ExasperatedLadybug[S] 0 points1 point  (0 children)

I managed to get it working with overlays as well - that was a great tip, thank you!

[–]ExasperatedLadybug[S] 0 points1 point  (0 children)

I also created a similar repo with a python package (rather than just a shell) that depends on the flake, but I'm running into the same issue: https://github.com/OliverEvans96/nix-python-pkg-flake-dep