From 514529545bab291d6351935baeb409355c608207 Mon Sep 17 00:00:00 2001 From: DavHau Date: Thu, 19 Mar 2026 21:48:10 +0800 Subject: [PATCH] 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. --- pkgs/test/top-level/default.nix | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pkgs/test/top-level/default.nix b/pkgs/test/top-level/default.nix index e713b617f8dd..3946b363b764 100644 --- a/pkgs/test/top-level/default.nix +++ b/pkgs/test/top-level/default.nix @@ -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; }