After a good night’s sleep:
qmake
needs PREFIX flag to be set to a path with Qt libs.
- It can be done either by passing an argument to
qmake
which is whatqmake-hook.sh
does when you addqmake
tonativeBuildInputs
. Using build inputs seems to also automatically usedev
outputs of specified input derivations as stated in Section 8.3. of nixpkgs manual. To use this in a development shell it seems one would need to create aqmake
wrapper which does the same asqmakeConfigurePhase
. - Or the PREFIX can be specified on
qt.conf
which is whatqt5.full
is seems to be doing by creating a derivation usingbuildEnv
which- Explicitely specifies that
dev
outputs of specified packages should be installed (inmkDerivation
this is implicit). - Symlinks not just
/bin
and/share
(or whatever the default is) but also/include
and/lib
to the derivation being created. - Copies
qmake
to$out/bin/
. - Creates
qt.conf
(on PATH && near theqmake
binary - don’t know which of that is relevant) with PREFIX set to the derivation being created.
- Explicitely specifies that
So I ended up with something like this in my buildFHSUserEnv
targetPkgs = pkgs: (with pkgs; [
gcc11
git
glib
gnumake
libGL
libglvnd
pkgconfig
python3
udev
wget
which
zlib
(buildEnv {
name = "qt-dev-env";
paths = with libsForQt5; [
qtbase
qtconnectivity
qtdeclarative
qtgamepad
qtlocation
qtquickcontrols2
qtserialport
qtsvg
];
# pathsToLink = [ "/bin" "/mkspecs" "/include" "/lib" "/share" ];
extraOutputsToInstall = [ "out" "dev" ];
postBuild = with libsForQt5; ''
rm "$out/bin/qmake"
cp "${qtbase.dev}/bin/qmake" "$out/bin"
cat >"$out/bin/qt.conf" <<EOF
[Paths]
Prefix = $out
Plugins = ${qtbase.qtPluginPrefix}
Qml2Imports = ${qtbase.qtQmlPrefix}
Documentation = ${qtbase.qtDocPrefix}
EOF
'';
})
]);
which works.
I digress.