about summary refs log tree commit diff
path: root/nixpkgs/pkgs/test/top-level/default.nix
blob: fdb9fe09a88b86d567fa2a5c9a736dab95d0addf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{ lib, pkgs, ... }:
let
  nixpkgsFun = import ../../top-level;
in
lib.recurseIntoAttrs {
  platformEquality =
    let
      configsLocal = [
        # crossSystem is implicitly set to localSystem.
        {
          localSystem = { system = "x86_64-linux"; };
        }
        {
          localSystem = { system = "aarch64-linux"; };
          crossSystem = null;
        }
        # Both systems explicitly set to the same string.
        {
          localSystem = { system = "x86_64-linux"; };
          crossSystem = { system = "x86_64-linux"; };
        }
        # Vendor and ABI inferred from system double.
        {
          localSystem = { system = "aarch64-linux"; };
          crossSystem = { config = "aarch64-unknown-linux-gnu"; };
        }
      ];
      configsCross = [
        # GNU is inferred from double, but config explicitly requests musl.
        {
          localSystem = { system = "aarch64-linux"; };
          crossSystem = { config = "aarch64-unknown-linux-musl"; };
        }
        # Cross-compile from AArch64 to x86-64.
        {
          localSystem = { system = "aarch64-linux"; };
          crossSystem = { system = "x86_64-unknown-linux-gnu"; };
        }
      ];

      pkgsLocal = map nixpkgsFun configsLocal;
      pkgsCross = map nixpkgsFun configsCross;
    in
    assert lib.all (p: p.buildPlatform == p.hostPlatform) pkgsLocal;
    assert lib.all (p: p.buildPlatform != p.hostPlatform) pkgsCross;
    pkgs.emptyFile;
}