[Optimizations] allow blacklisting lto for specific packages

This commit is contained in:
Antoine Viallon 2023-05-05 11:38:26 +02:00
parent c75abbeffa
commit 49a6dd3bb4
Signed by: aviallon
GPG key ID: 186FC35EDEB25716

View file

@ -13,10 +13,12 @@ let
cpuTune ? generalCfg.cpu.tune, cpuTune ? generalCfg.cpu.tune,
extraCFlags ? cfg.extraCompileFlags, extraCFlags ? cfg.extraCompileFlags,
blacklist ? cfg.blacklist, blacklist ? cfg.blacklist,
ltoBlacklist ? cfg.lto.blacklist,
overrideMap ? cfg.overrideMap, overrideMap ? cfg.overrideMap,
recursive ? 1, recursive ? 1,
level ? "slower", level ? "slower",
lto ? cfg.lto, lto ? cfg.lto,
stdenv ? null,
... ...
}@attrs: pkg: }@attrs: pkg:
myLib.optimizations.optimizePkg pkg ({ myLib.optimizations.optimizePkg pkg ({
@ -30,10 +32,17 @@ in {
description = "Enable aviallon's optimizations"; description = "Enable aviallon's optimizations";
type = types.bool; type = types.bool;
}; };
lto = mkOption { lto = {
description = "Wether to enable LTO for some packages"; enable = mkOption {
type = types.bool; description = "Wether to enable LTO for some packages";
default = true; type = types.bool;
default = true;
};
blacklist = mkOption {
description = "Packages to blacklist from LTO";
type = types.listOf types.str;
default = [ "x265" "cpio" "cups" "gtk+3" "which" ];
};
}; };
extraCompileFlags = mkOption { extraCompileFlags = mkOption {
default = [ "-mtune=${generalCfg.cpuTune}" ]; default = [ "-mtune=${generalCfg.cpuTune}" ];
@ -65,7 +74,6 @@ in {
overrideMap = mkOption { overrideMap = mkOption {
type = with types; attrsOf package; type = with types; attrsOf package;
default = { default = {
stdenv = pkgs.fastStdenv;
}; };
example = literalExpression example = literalExpression
'' ''