diff options
author | Ivan Trubach <mr.trubach@icloud.com> | 2023-09-12 16:55:32 +0300 |
---|---|---|
committer | Ivan Trubach <mr.trubach@icloud.com> | 2023-09-13 07:22:52 +0300 |
commit | d4063e0330ec9f68037d4dbdd12aec3376e679ba (patch) | |
tree | 61a70c87a586a1ae04e93e2edd50db7f23f4615b /pkgs/top-level | |
parent | 240cbdc845436995fa10fdc781c58a069f326d8f (diff) |
pkgs/top-level: use lib.systems.equals for crossSystem
Fixes otherwise equivalent systems being treated as different by packages that compare `stdenv.*Platform`s using `==` operator.
Diffstat (limited to 'pkgs/top-level')
-rw-r--r-- | pkgs/top-level/default.nix | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/pkgs/top-level/default.nix b/pkgs/top-level/default.nix index ba00e78ce2e62..5c224802d5bf3 100644 --- a/pkgs/top-level/default.nix +++ b/pkgs/top-level/default.nix @@ -61,10 +61,22 @@ in let localSystem = lib.systems.elaborate args.localSystem; # Condition preserves sharing which in turn affects equality. + # + # See `lib.systems.equals` documentation for more details. + # + # Note that it is generally not possible to compare systems as given in + # parameters, e.g. if systems are initialized as + # + # localSystem = { system = "x86_64-linux"; }; + # crossSystem = { config = "x86_64-unknown-linux-gnu"; }; + # + # Both systems are semantically equivalent as the same vendor and ABI are + # inferred from the system double in `localSystem`. crossSystem = - if crossSystem0 == null || crossSystem0 == args.localSystem + let system = lib.systems.elaborate crossSystem0; in + if crossSystem0 == null || lib.systems.equals system localSystem then localSystem - else lib.systems.elaborate crossSystem0; + else system; # Allow both: # { /* the config */ } and |