nix: make mold optional

This commit is contained in:
Mihai Fufezan 2025-08-21 20:05:54 +03:00
parent e631ea36dd
commit b364dcb739
Signed by: fufexan
SSH key fingerprint: SHA256:SdnKmEpJrDu1+2UO1QpB/Eg4HKcdDi6n+xSRqFNJVpg

View file

@ -8,13 +8,16 @@
version ? "git",
doCheck ? false,
debug ? false,
# whether to use the mold linker
# disable this for older machines without SSE4_2 and AVX2 support
withMold ? true,
}: let
inherit (builtins) foldl';
inherit (lib.lists) flatten;
inherit (lib.strings) optionalString;
adapters = flatten [
stdenvAdapters.useMoldLinker
(lib.optional withMold stdenvAdapters.useMoldLinker)
(lib.optional debug stdenvAdapters.keepDebugInfo)
];