mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-21 16:11:22 +00:00
makeOverridablePythonPackage: simplify implementation
Attach overridePythonAttrs by attribute set update instead of `stdenv.mkDerivation`'s `passthru`. Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
This commit is contained in:
@@ -19,22 +19,13 @@ let
|
||||
lib.mirrorFunctionArgs f (
|
||||
origArgs:
|
||||
let
|
||||
args = lib.fix (
|
||||
lib.extends (_: previousAttrs: {
|
||||
passthru = (previousAttrs.passthru or { }) // {
|
||||
overridePythonAttrs = newArgs: makeOverridablePythonPackage f (overrideWith newArgs);
|
||||
};
|
||||
}) (_: origArgs)
|
||||
);
|
||||
result = f args;
|
||||
overrideWith = newArgs: args // (if pkgs.lib.isFunction newArgs then newArgs args else newArgs);
|
||||
result = f origArgs;
|
||||
overrideWith = newArgs: origArgs // lib.toFunction newArgs origArgs;
|
||||
in
|
||||
if builtins.isAttrs result then
|
||||
if lib.isAttrs result then
|
||||
result
|
||||
else if builtins.isFunction result then
|
||||
{
|
||||
// {
|
||||
overridePythonAttrs = newArgs: makeOverridablePythonPackage f (overrideWith newArgs);
|
||||
__functor = self: result;
|
||||
}
|
||||
else
|
||||
result
|
||||
|
||||
Reference in New Issue
Block a user