applyPatches: ensure overrides are carried down

This commit is contained in:
Ross Smyth
2026-02-13 14:47:31 -05:00
parent 354aab19f9
commit 3e2365433e
+15 -14
View File
@@ -1037,24 +1037,24 @@ rec {
let
keepAttrs = names: lib.filterAttrs (name: val: lib.elem name names);
# enables tools like nix-update to determine what src attributes to replace
extraPassthru = lib.optionalAttrs (lib.isAttrs src) (
extraPassthru = lib.optionalAttrs (lib.isAttrs finalAttrs.src) (
keepAttrs [
"rev"
"tag"
"url"
"outputHash"
"outputHashAlgo"
] src
] finalAttrs.src
);
in
{
name =
args.name or (
if builtins.isPath src then
baseNameOf src + "-patched"
else if builtins.isAttrs src && (src ? name) then
if builtins.isPath finalAttrs.src then
baseNameOf finalAttrs.src + "-patched"
else if builtins.isAttrs finalAttrs.src && (finalAttrs.src ? name) then
let
srcName = builtins.parseDrvName src;
srcName = builtins.parseDrvName finalAttrs.src.name;
in
"${srcName.name}-patched${lib.optionalString (srcName.version != "") "-${srcName.version}"}"
else
@@ -1069,19 +1069,20 @@ rec {
allowSubstitutes = false;
# unconditionally disable phases that are we don't want
dontConfigure = true;
dontBuild = true;
doCheck = false;
doInstallCheck = false;
dontFixup = true;
doDist = false;
phases = [
"unpackPhase"
"patchPhase"
"installPhase"
];
installPhase = "cp -R ./ $out";
passthru = extraPassthru // src.passthru or { };
# passthru the git and hash info for nix-update, as well
# as all the src's passthru attrs.
passthru = extraPassthru // finalAttrs.src.passthru or { };
# Carry (and merge) information from the underlying `src` if present.
meta = lib.optionalAttrs (src ? meta) (removeAttrs src.meta) [ "position" ];
meta = lib.optionalAttrs (src ? meta) (removeAttrs finalAttrs.src.meta) [ "position" ];
};
};