summary refs log tree commit diff
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-06-13 10:22:06 +0200
committerRobert Hensing <robert@roberthensing.nl>2023-06-13 10:22:06 +0200
commit144018541b20a0aa74ce32120b3a27660fab93dd (patch)
tree78b9706e044d023a6d780cb895c8196e8fb7e82d
parent18c7f6237f92ef5ef9d7cf106ec2ffb72af336fc (diff)
downloadnixpkgs-144018541b20a0aa74ce32120b3a27660fab93dd.tar
nixpkgs-144018541b20a0aa74ce32120b3a27660fab93dd.tar.gz
nixpkgs-144018541b20a0aa74ce32120b3a27660fab93dd.tar.bz2
nixpkgs-144018541b20a0aa74ce32120b3a27660fab93dd.tar.lz
nixpkgs-144018541b20a0aa74ce32120b3a27660fab93dd.tar.xz
nixpkgs-144018541b20a0aa74ce32120b3a27660fab93dd.tar.zst
nixpkgs-144018541b20a0aa74ce32120b3a27660fab93dd.zip
lib.systems.equals: Ignore all function attributes reflectively
Co-authored-by: Artturi <Artturin@artturin.com>
-rw-r--r--lib/systems/default.nix4
-rw-r--r--lib/tests/systems.nix2
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/systems/default.nix b/lib/systems/default.nix
index abaad19a3e1..3558ce32fc8 100644
--- a/lib/systems/default.nix
+++ b/lib/systems/default.nix
@@ -24,8 +24,8 @@ rec {
     both arguments have been `elaborate`-d.
   */
   equals =
-    let uncomparable = { canExecute = null; emulator = null; emulatorAvailable = null; isCompatible = null; };
-    in a: b: a // uncomparable == b // uncomparable;
+    let removeFunctions = a: lib.filterAttrs (_: v: !builtins.isFunction v) a;
+    in a: b: removeFunctions a == removeFunctions b;
 
   /*
     Try to convert an elaborated system back to a simple string. If not possible,
diff --git a/lib/tests/systems.nix b/lib/tests/systems.nix
index 082b3549086..617fb0d18b1 100644
--- a/lib/tests/systems.nix
+++ b/lib/tests/systems.nix
@@ -69,7 +69,7 @@ lib.runTests (
     let modified =
           assert origValue != arbitraryValue;
           lib.systems.elaborate "x86_64-linux" // { ${platformAttrName} = arbitraryValue; };
-        arbitraryValue = "<<modified>>";
+        arbitraryValue = x: "<<modified>>";
     in {
       expr = lib.systems.equals (lib.systems.elaborate "x86_64-linux") modified;
       expected = {