From 4931a5f10c2ca5ca0b89f5b957bf87d0700947e7 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sat, 30 May 2026 14:29:04 +0200 Subject: [PATCH] nix-supports/outputs: only build packages on platforms that are available If e.g. i686-linux is not in the list of systems and thus no attribute in `nixpkgsFor` exists (e.g. on hydra.afnix.fr), don't try to instantiate it. Change-Id: I118e2af5289ad7bd95ce7f1e6b0728afb6f0321f --- nix-support/build/outputs.nix | 20 ++++++++++---------- tests/nixos/default.nix | 4 +++- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/nix-support/build/outputs.nix b/nix-support/build/outputs.nix index 9c393e2a0..7b1c45852 100644 --- a/nix-support/build/outputs.nix +++ b/nix-support/build/outputs.nix @@ -139,16 +139,6 @@ lib.fix (self: { # Binary package for various platforms. build = forAllSystems (system: self.packages.${system}.nix); - # Ensure support for lowdown < 3.0 doesn't regress for NixOS 25.11 - build-lowdown_2_0 = lib.genAttrs [ "aarch64-linux" ] ( - system: - assert lib.versionOlder nixpkgsFor.${system}.native.lowdown.version "3.0.0"; - self.packages.${system}.nix.override { - lowdown = nixpkgsFor.${system}.native.lowdown; - lowdown-unsandboxed = nixpkgsFor.${system}.native.lowdown-unsandboxed; - } - ); - buildStatic = lib.genAttrs linux64BitSystems (system: self.packages.${system}.nix-static); rl-next = forAllSystems ( @@ -208,5 +198,15 @@ lib.fix (self: { doCheck = false; doInstallCheck = false; }); + } + // lib.optionalAttrs (nixpkgsFor ? aarch64-linux) { + build-lowdown_2_0 = lib.genAttrs [ "aarch64-linux" ] ( + system: + assert lib.versionOlder nixpkgsFor.${system}.native.lowdown.version "3.0.0"; + self.packages.${system}.nix.override { + lowdown = nixpkgsFor.${system}.native.lowdown; + lowdown-unsandboxed = nixpkgsFor.${system}.native.lowdown-unsandboxed; + } + ); }; }) diff --git a/tests/nixos/default.nix b/tests/nixos/default.nix index fff155497..dce4566d9 100644 --- a/tests/nixos/default.nix +++ b/tests/nixos/default.nix @@ -8,6 +8,8 @@ let nixos-lib = import (nixpkgs + "/nixos/lib") { }; + filterPlatforms = lib.filter (p: nixpkgsFor?${p}); + # https://nixos.org/manual/nixos/unstable/index.html#sec-calling-nixos-tests runNixOSTestFor = system: test: @@ -186,7 +188,7 @@ in cgroups = runNixOSTestFor "x86_64-linux" ./cgroups; - setuid = lib.genAttrs [ "i686-linux" "x86_64-linux" ] ( + setuid = lib.genAttrs (filterPlatforms [ "i686-linux" "x86_64-linux" ]) ( system: runNixOSTestFor system ./setuid/setuid.nix );