From eb875b4a98cc48956f84f12e351cf8b6c0ae7f96 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Mon, 21 Jul 2025 22:41:12 +0200 Subject: [PATCH] pkgsi686Linux: only throw with aliases enabled For the regular user, this still throws early whenever an attribute tries to use `pkgsi686Linux`. For CI, this doesn't throw, but instead overwrites `mkDerivation` to return only derivations marked as `meta.broken`. This propagates to all reverse dependencies and allows filtering out these attributes nicely on unsupported platforms. --- pkgs/top-level/stage.nix | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/pkgs/top-level/stage.nix b/pkgs/top-level/stage.nix index b37311b8f0e3..0b94502a96c9 100644 --- a/pkgs/top-level/stage.nix +++ b/pkgs/top-level/stage.nix @@ -240,12 +240,32 @@ let # All packages built for i686 Linux. # Used by wine, firefox with debugging version of Flash, ... pkgsi686Linux = - if stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86 then + let + isSupported = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isx86; + in + if !config.allowAliases || isSupported then nixpkgsFun { overlays = [ - (self': super': { - pkgsi686Linux = super'; - }) + ( + self': super': + { + pkgsi686Linux = super'; + } + // lib.optionalAttrs (!isSupported) { + # Overrides pkgsi686Linux.stdenv.mkDerivation to produce only broken derivations, + # when used on a non x86_64-linux platform in CI. + # TODO: Remove this, once pkgsi686Linux can become a variant. + stdenv = super'.stdenv // { + mkDerivation = + args: + (super'.stdenv.mkDerivation args).overrideAttrs (prevAttrs: { + meta = prevAttrs.meta or { } // { + broken = true; + }; + }); + }; + } + ) ] ++ overlays; ${if stdenv.hostPlatform == stdenv.buildPlatform then "localSystem" else "crossSystem"} = { config = lib.systems.parse.tripleFromSystem (