Files
CST-agent/scripts/qt6-host.nix
T
2026-10-19 10:41:00 +08:00

39 lines
1.2 KiB
Nix

/* The host (Linux) side of the Windows GUI cross build: nixpkgs' native Qt 6
* tools in one prefix, for QT_HOST_PATH.
*
* MSYS2's Qt for Windows ships moc.exe, rcc.exe, qmlcachegen.exe and the rest
* as Windows programs, which a Linux build cannot run; Qt wants the host tools
* to be the *same version* as the target Qt (6.11.2 here, which is what
* nixpkgs' Qt 6 is), so they come from nixpkgs rather than from MSYS2.
*
* scripts/package_windows_app.sh builds this and points the cross build at it.
* Not a package: nothing installs it, it is a prefix assembled from the store
* paths of qtbase/qtdeclarative/qtsvg (bin, libexec, lib/cmake, share/qt6).
*/
with import <nixpkgs> {};
let
qtPkgs = [
qt6.qtbase
qt6.qtbase.dev
qt6.qtdeclarative
qt6.qtdeclarative.dev
qt6.qtsvg
qt6.qtsvg.dev
];
script = ''
set -eu
mkdir -p $out
for p in ${builtins.concatStringsSep " " (map toString qtPkgs)}; do
[ -d "$p" ] || continue
for d in bin lib/cmake libexec share/qt6; do
if [ -d "$p/$d" ]; then
mkdir -p "$out/$d"
cp -rs "$p/$d/." "$out/$d/" 2>/dev/null || true
fi
done
done
'';
in
runCommand "qt6-host" { } script