1 { lib, pkgs, stdenvNoCC }:
6 p = pkgs.python3Packages.xpybutil.overridePythonAttrs (_: { dontWrapPythonPrograms = true; });
9 overridePythonAttrs = {
10 expr = !lib.hasInfix "wrapPythonPrograms" p.postFixup;
13 repeatedOverrides-pname = {
14 expr = repeatedOverrides.pname == "a-better-hello-with-blackjack";
17 repeatedOverrides-entangled-pname = {
18 expr = repeatedOverrides.entangled.pname == "a-better-figlet-with-blackjack";
21 overriding-using-only-attrset = {
22 expr = (pkgs.hello.overrideAttrs { pname = "hello-overriden"; }).pname == "hello-overriden";
25 overriding-using-only-attrset-no-final-attrs = {
26 name = "overriding-using-only-attrset-no-final-attrs";
27 expr = ((stdenvNoCC.mkDerivation { pname = "hello-no-final-attrs"; }).overrideAttrs { pname = "hello-no-final-attrs-overridden"; }).pname == "hello-no-final-attrs-overridden";
32 addEntangled = origOverrideAttrs: f:
34 lib.composeExtensions f (self: super: {
35 passthru = super.passthru // {
36 entangled = super.passthru.entangled.overrideAttrs f;
37 overrideAttrs = addEntangled self.overrideAttrs;
42 entangle = pkg1: pkg2: pkg1.overrideAttrs (self: super: {
43 passthru = super.passthru // {
45 overrideAttrs = addEntangled self.overrideAttrs;
49 example = entangle pkgs.hello pkgs.figlet;
51 overrides1 = example.overrideAttrs (_: super: { pname = "a-better-${super.pname}"; });
53 repeatedOverrides = overrides1.overrideAttrs (_: super: { pname = "${super.pname}-with-blackjack"; });
56 stdenvNoCC.mkDerivation {
57 name = "test-overriding";
58 passthru = { inherit tests; };
61 '' + lib.concatStringsSep "\n" (lib.attrValues (lib.mapAttrs (name: t: "([[ ${lib.boolToString t.expr} == ${lib.boolToString t.expected} ]] && echo '${name} success') || (echo '${name} fail' && exit 1)") tests));