1 { lib, pkgs, stdenvNoCC }:
6 p = pkgs.python3Packages.xpybutil.overridePythonAttrs (_: { dontWrapPythonPrograms = true; });
10 name = "overridePythonAttrs";
11 expr = !lib.hasInfix "wrapPythonPrograms" p.postFixup;
15 name = "repeatedOverrides-pname";
16 expr = repeatedOverrides.pname == "a-better-hello-with-blackjack";
20 name = "repeatedOverrides-entangled-pname";
21 expr = repeatedOverrides.entangled.pname == "a-better-figlet-with-blackjack";
25 name = "overriding-using-only-attrset";
26 expr = (pkgs.hello.overrideAttrs { pname = "hello-overriden"; }).pname == "hello-overriden";
30 name = "overriding-using-only-attrset-no-final-attrs";
31 expr = ((stdenvNoCC.mkDerivation { pname = "hello-no-final-attrs"; }).overrideAttrs { pname = "hello-no-final-attrs-overridden"; }).pname == "hello-no-final-attrs-overridden";
36 addEntangled = origOverrideAttrs: f:
38 lib.composeExtensions f (self: super: {
39 passthru = super.passthru // {
40 entangled = super.passthru.entangled.overrideAttrs f;
41 overrideAttrs = addEntangled self.overrideAttrs;
46 entangle = pkg1: pkg2: pkg1.overrideAttrs (self: super: {
47 passthru = super.passthru // {
49 overrideAttrs = addEntangled self.overrideAttrs;
53 example = entangle pkgs.hello pkgs.figlet;
55 overrides1 = example.overrideAttrs (_: super: { pname = "a-better-${super.pname}"; });
57 repeatedOverrides = overrides1.overrideAttrs (_: super: { pname = "${super.pname}-with-blackjack"; });
60 stdenvNoCC.mkDerivation {
61 name = "test-overriding";
62 passthru = { inherit tests; };
65 '' + lib.concatMapStringsSep "\n" (t: "([[ ${lib.boolToString t.expr} == ${lib.boolToString t.expected} ]] && echo '${t.name} success') || (echo '${t.name} fail' && exit 1)") tests;