Commit 51452954 authored by DavHau's avatar DavHau
Browse files

tests.top-level: add test for appendOverlays preserving splicing

Ensures that appendOverlays with an empty list returns spliced
packages, so that cross-compilation in NixOS modules works correctly.
parent 99ab2550
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -64,4 +64,22 @@ lib.recurseIntoAttrs {
    assert lib.all (p: p.stdenv.buildPlatform == p.stdenv.hostPlatform) pkgsLocal;
    assert lib.all (p: p.stdenv.buildPlatform != p.stdenv.hostPlatform) pkgsCross;
    pkgs.emptyFile;

  # appendOverlays must preserve splicing so that cross-compilation
  # works in NixOS modules (which go through appendOverlays via nixpkgs.nix).
  appendOverlaysPreservesSplicing =
    let
      cross = nixpkgsFun {
        localSystem = {
          system = "x86_64-linux";
        };
        crossSystem = {
          system = "aarch64-linux";
        };
      };
      appended = cross.appendOverlays [ ];
    in
    assert cross.makeWrapper ? __spliced;
    assert appended.makeWrapper ? __spliced;
    pkgs.emptyFile;
}