From 4bb4cff36852dda1e32fc2ee0d377b516ca02339 Mon Sep 17 00:00:00 2001 From: Aliaksandr Date: Sat, 9 May 2026 17:40:32 +0300 Subject: [PATCH] stdenv: deprecate `is*` aliases in favor of `hostPlatform.is*` These shorthands hide the platform distinction and are unfit for cross-compilation. Wrap them in `lib.warn` so each access prints a deprecation notice, and gate them on `config.allowAliases` so they can be removed entirely. Assisted-by: claude-code with claude-opus-4-8 --- pkgs/stdenv/generic/default.nix | 48 ++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/pkgs/stdenv/generic/default.nix b/pkgs/stdenv/generic/default.nix index 95d9228d7da2..6d78cc0f0c14 100644 --- a/pkgs/stdenv/generic/default.nix +++ b/pkgs/stdenv/generic/default.nix @@ -201,25 +201,35 @@ let extraSandboxProfile ; - # Utility flags to test the type of platform. - inherit (hostPlatform) - isDarwin - isLinux - isSunOS - isCygwin - isBSD - isFreeBSD - isOpenBSD - isi686 - isx86_32 - isx86_64 - is32bit - is64bit - isAarch32 - isAarch64 - isMips - isBigEndian - ; + } + // lib.optionalAttrs config.allowAliases ( + lib.mapAttrs + ( + name: value: lib.warn "stdenv.${name} is deprecated, use stdenv.hostPlatform.${name} instead" value + ) + { + # Added 2026-05-09 + inherit (hostPlatform) + isDarwin + isLinux + isSunOS + isCygwin + isBSD + isFreeBSD + isOpenBSD + isi686 + isx86_32 + isx86_64 + is32bit + is64bit + isAarch32 + isAarch64 + isMips + isBigEndian + ; + } + ) + // { # Override `system` so that packages can get the system of the host # platform through `stdenv.system`. `system` is originally set to the