[Optimizations] Add ability to specify additional attributes to package override

This commit is contained in:
Antoine Viallon 2023-08-10 16:32:26 +02:00
parent 38e8749e77
commit 3e472dff54
Signed by: aviallon
GPG key ID: 186FC35EDEB25716
2 changed files with 6 additions and 2 deletions

View file

@ -215,6 +215,7 @@ rec {
, overrideMap ? { }
, stdenv ? null
, lto ? false
, attributes ? { }
, _depth ? 0
, ...
}@attrs:
@ -289,8 +290,10 @@ rec {
CFLAGS = if (! isList old.CFLAGS) then [ old.CFLAGS ] else old.CFLAGS;
}
);
_pkgOptimized = addAttrs _pkg optimizedAttrs;
_pkgFinal = addAttrs _pkgOptimized attributes;
in
trace "Optimized ${myGetName pkg} with overrideAttrs at level '${level}' (depth: ${toString _depth}, lto: ${toString lto})" (addAttrs _pkg optimizedAttrs)
trace "Optimized ${myGetName pkg} with overrideAttrs at level '${level}' (depth: ${toString _depth}, lto: '${toString lto}')" _pkgFinal
else if (hasAttr "name" pkg) then
warn "Can't optimize ${myGetName pkg} (depth: ${toString _depth})" pkg
else

View file

@ -16,11 +16,12 @@ let
ltoBlacklist ? cfg.lto.blacklist,
overrideMap ? cfg.overrideMap,
lto ? cfg.lto,
attributes ? {},
stdenv ? null,
...
}@attrs: pkg:
myLib.optimizations.optimizePkg pkg (cfg.defaultSettings // {
inherit cpuCores cpuTune cpuArch extraCFlags blacklist ltoBlacklist overrideMap stdenv;
inherit cpuCores cpuTune cpuArch extraCFlags blacklist ltoBlacklist overrideMap stdenv attributes;
} // attrs);
in {
options.aviallon.optimizations = {