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
This commit is contained in:
Aliaksandr
2026-05-09 17:40:32 +03:00
committed by Weijia Wang
parent 9921d05da3
commit 4bb4cff368

View File

@@ -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