depot/pkgs/test/top-level/default.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

47 lines
1.4 KiB
Nix

{ 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;
}