diff --git a/pkgs/lib/misc.nix b/pkgs/lib/misc.nix index 548b8d22edf..1d43918ce56 100644 --- a/pkgs/lib/misc.nix +++ b/pkgs/lib/misc.nix @@ -382,4 +382,17 @@ rec { ["flags" "cfg" "mergeAttrBy" "fixed" ]; # fixed may be passed as fix argument or such -} \ No newline at end of file + # deep, strict equality testing. This should be implemented as primop + eqStrict = a : b : + let eqListStrict = a : b : + if (a == []) != (b == []) then false + else if a == [] then true + else eqStrict (__head a) (__head b) && eqListStrict (__tail a) (__tail b); + in + if __isList a && __isList b then eqListStrict a b + else if __isAttrs a && isAttrs b then + (eqListStrict (__attrNames a) (__attrNames b)) + && (eqListStrict (lib.attrValues a) (lib.attrValues b)) + else a == b; # FIXME ! +} +