plugin: switch from ld.gold to mold (cxx-qt docs recommend moving away from gold)

This commit is contained in:
Damocles 2026-05-04 23:12:34 +02:00
parent f34f3f2f4e
commit 4f5cf5f5fa

View file

@ -1,6 +1,7 @@
{
lib,
craneLib,
mold,
pkg-config,
qt6,
writeShellScript,
@ -67,6 +68,7 @@ let
nativeBuildInputs = [
pkg-config
mold
qt6.qtbase
qt6.qtdeclarative
];
@ -79,8 +81,12 @@ let
# qt6.qtbase's setup hook overrides QMAKE after derivation attrs are set,
# so re-assert it in preBuild which runs after all setup hooks.
# Force mold as the linker (cxx-qt book deprecates ld.gold). Setting via
# CARGO_TARGET_*_LINKER + RUSTFLAGS is the only path that survives nixpkgs'
# cc-wrapper - `-fuse-ld=` from build.rs gets eaten by the wrapper.
preBuild = ''
export QMAKE=${qmakeWrapper}
export RUSTFLAGS="-C link-arg=-fuse-ld=mold ''${RUSTFLAGS:-}"
'';
};