about summary refs log tree commit diff
path: root/pkgs/test
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2023-06-21 17:30:32 +0300
committerArtturin <Artturin@artturin.com>2023-06-30 23:28:00 +0300
commit0fdae315315686d180d924a7c33066fbc5b4c14d (patch)
treec2d1f96710e183a3aa35e7a22bf8461196b51a72 /pkgs/test
parent3cd360a2de66c1f17099b2edffdf1842c1266abd (diff)
stdenv: let overrideAttrs accept attrset OR function
Makes overrideAttrs usable in the same way that `override` can be used.
It allows the first argument of `overrideAttrs` to be either a function
or an attrset, instead of only a function:

hello.overrideAttrs (old: { postBuild = "echo hello"; })
hello.overrideAttrs { postBuild = "echo hello"; }

Previously only the first example was possible.

Co-authored-by: adisbladis <adisbladis@gmail.com>
Co-authored-by: matthewcroughan <matt@croughan.sh>
Diffstat (limited to 'pkgs/test')
-rw-r--r--pkgs/test/overriding.nix5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkgs/test/overriding.nix b/pkgs/test/overriding.nix
index edc1b27cf4f1d..7838f637f3134 100644
--- a/pkgs/test/overriding.nix
+++ b/pkgs/test/overriding.nix
@@ -21,6 +21,11 @@ let
         expr = repeatedOverrides.entangled.pname == "a-better-figlet-with-blackjack";
         expected = true;
       })
+      ({
+        name = "overriding-using-only-attrset";
+        expr = (pkgs.hello.overrideAttrs { pname = "hello-overriden"; }).pname == "hello-overriden";
+        expected = true;
+      })
     ];
 
   addEntangled = origOverrideAttrs: f: