Help packaging complex project

I’m trying to package a project that provides all kind of things: libs, a number of cli tools, a python module and a graphical Qt app (built with PySide as it seems). It all builds with at the same time.

So i’m a bit lost how to do that.
I’ve managed to build it all together, so cli tools and libs are fine, but

  • what to do with python module at all, how should i present it so it can be used in somewhat usual way in nix?
  • how to wrap that Qt PySide2 python app? I’ve added libsForQt5.wrapQtAppHook to native build inputs, and wrapped it manually with wrapQtApp "$out/bin/usdview" --prefix PYTHONPATH : $out/lib/python so it has qt platforms, and sees the built python module.
    BUT - it does not see PySide2 (and other python dependencies), even if I add them to propagatedBuildInputs
1 Like

trying to answer my own question:
i’ve added python input with python version to be provided, for qt using explicitly libsForQt5 (though manual discourages it) as I need PySide2 python module, which uses qt5.

then nativeBuildInputs = [ cmake libsForQt5.wrapQtAppHook python.pkgs.wrapPython ]

disable qt autowrapping: dontWrapQtApps = true;

then on post fixup stage:
first do the python wrapping, then do qt wrapping

postFixup = ''
    wrapPythonProgramsIn "$out/bin" "$out $pythonPath"
    wrapQtApp "$out/bin/usdview"

as I figure out, wrapPythonProgramsIn will look for default site-packages subpath based on python version in path list provided, AND it will look in nix-support/propagated-build-inputs, so I need to put my python dependencies in propagatedBuildInputs for them to be used by wrapper (and that’s why $out is needed in path list)

so, wrapPythonProgramsIn will wrap all python scripts in $out/bin so that they have access to python modules at the moment of wrapping, and then wrapQtApp will wrap the PySide using script once more with all the Qt related crap

Please, oh wise wizards, correct my mistakes

there are several packages that could be found (including boost), that optionally provide python bindings and can be used (I used) as an example, you can find them in the list here: top-level/python-packages.nix (anything that uses toPythonModule function)