forked from mirrors/nixpkgs
tests.overriding: add repeatedOverrides-pname, repeatedOverrides-entangled-pname
from https://github.com/NixOS/nixpkgs/pull/201734#pullrequestreview-1185972282
This commit is contained in:
parent
9c0ac5691c
commit
a0f4e8746d
|
@ -11,7 +11,40 @@ let
|
|||
expr = !lib.hasInfix "wrapPythonPrograms" p.postFixup;
|
||||
expected = true;
|
||||
})
|
||||
({
|
||||
name = "repeatedOverrides-pname";
|
||||
expr = repeatedOverrides.pname == "a-better-hello-with-blackjack";
|
||||
expected = true;
|
||||
})
|
||||
({
|
||||
name = "repeatedOverrides-entangled-pname";
|
||||
expr = repeatedOverrides.entangled.pname == "a-better-figlet-with-blackjack";
|
||||
expected = true;
|
||||
})
|
||||
];
|
||||
|
||||
addEntangled = origOverrideAttrs: f:
|
||||
origOverrideAttrs (
|
||||
lib.composeExtensions f (self: super: {
|
||||
passthru = super.passthru // {
|
||||
entangled = super.passthru.entangled.overrideAttrs f;
|
||||
overrideAttrs = addEntangled self.overrideAttrs;
|
||||
};
|
||||
})
|
||||
);
|
||||
|
||||
entangle = pkg1: pkg2: pkg1.overrideAttrs (self: super: {
|
||||
passthru = super.passthru // {
|
||||
entangled = pkg2;
|
||||
overrideAttrs = addEntangled self.overrideAttrs;
|
||||
};
|
||||
});
|
||||
|
||||
example = entangle pkgs.hello pkgs.figlet;
|
||||
|
||||
overrides1 = example.overrideAttrs (_: super: { pname = "a-better-${super.pname}"; });
|
||||
|
||||
repeatedOverrides = overrides1.overrideAttrs (_: super: { pname = "${super.pname}-with-blackjack"; });
|
||||
in
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
|
|
Loading…
Reference in a new issue