lib: replace deprecated overrideDerivation with overrideAttrs
overrideDerivation has been deprecated since 2019. The new overrideAttrs properly handles the env attribute set used by modern derivations to avoid the NIX_CFLAGS_COMPILE overlap error between env and top-level derivation arguments.
This commit is contained in:
@@ -10,20 +10,16 @@ inputs.nixpkgs.lib.extend (
|
||||
lib = prev;
|
||||
in
|
||||
{
|
||||
# stolen from: https://stackoverflow.com/a/42398526
|
||||
optimizeWithFlags =
|
||||
pkg: flags:
|
||||
lib.overrideDerivation pkg (
|
||||
old:
|
||||
let
|
||||
newflags = lib.foldl' (acc: x: "${acc} ${x}") "" flags;
|
||||
oldflags = if (lib.hasAttr "NIX_CFLAGS_COMPILE" old) then "${old.NIX_CFLAGS_COMPILE}" else "";
|
||||
in
|
||||
{
|
||||
NIX_CFLAGS_COMPILE = "${oldflags} ${newflags}";
|
||||
# stdenv = pkgs.clang19Stdenv;
|
||||
}
|
||||
);
|
||||
pkg.overrideAttrs (old: {
|
||||
env = (old.env or { }) // {
|
||||
NIX_CFLAGS_COMPILE =
|
||||
(old.env.NIX_CFLAGS_COMPILE or old.NIX_CFLAGS_COMPILE or "")
|
||||
+ " "
|
||||
+ (lib.concatStringsSep " " flags);
|
||||
};
|
||||
});
|
||||
|
||||
optimizePackage =
|
||||
pkg:
|
||||
|
||||
Reference in New Issue
Block a user