Python and linking C libraries is… A story.
Usually this is done at runtime, so your build-time config likely doesn’t matter. Nix will automatically also install build inputs if their files appear in the built binaries, but since python finds your library at runtime this won’t work.
This isn’t true for all python packages though, and often the library resolution is broken in ways that are exposed on NixOS (e.g. because it assumes “Linux” = current Ubuntu LTS and the library is in a specific location with a specific name), so let’s see what this package does.
Easiest way to do that is to look at the package. If it’s a build time failure we inspect the setup.py
, but it isn’t, so digging in the package I found your error message here: https://github.com/BoboTiG/python-mss/blob/7b5cff83715b6f2f4c1e46a184c73be2b7657263/mss/linux.py#L289
So, this package uses ctypes.find_library. This is good, since it’s a standard library feature, and in the worst case patched on NixOS. It’s still done at runtime, so we need to make sure the dependency is propagated.
Luckily, this is quite easy, and the python build docs even recommend it somewhere in here (we desperately need to move to readthedocs) - just replace your buildInputs
in the package with propagatedBuildInputs