muon: use mesonOption-related functions

This specific commit is intended to demonstrate a somewhat real world use case
for the new meson.* utilities defined in lib/strings.nix
This commit is contained in:
AndersonTorres 2022-11-20 13:05:36 -03:00
parent 85b6175ccb
commit 3b66936599

View file

@ -81,14 +81,13 @@ stdenv.mkDerivation (finalAttrs: {
'';
buildPhase = let
muonFeatureFlag = feature: flag:
"-D${feature}=${if flag then "enabled" else "disabled"}";
muonConditionFlag = condition: flag:
"-D${condition}=${lib.boolToString flag}";
muonBool = lib.mesonBool;
muonEnable = lib.mesonEnable;
cmdlineForMuon = lib.concatStringsSep " " [
(muonConditionFlag "static" stdenv.targetPlatform.isStatic)
(muonFeatureFlag "docs" buildDocs)
(muonFeatureFlag "samurai" embedSamurai)
(muonBool "static" stdenv.targetPlatform.isStatic)
(muonEnable "docs" buildDocs)
(muonEnable "samurai" embedSamurai)
];
cmdlineForSamu = "-j$NIX_BUILD_CORES";
in ''