From e0464e47880a69896f0fb1810f00e0de469f770a Mon Sep 17 00:00:00 2001 From: Artturin Date: Tue, 24 Sep 2024 18:50:49 +0300 Subject: treewide: replace `stdenv.is` with `stdenv.hostPlatform.is` In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ``` --- pkgs/tools/misc/coreutils/default.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'pkgs/tools/misc/coreutils/default.nix') diff --git a/pkgs/tools/misc/coreutils/default.nix b/pkgs/tools/misc/coreutils/default.nix index d9fbd4459f04..5bbc3b9581ee 100644 --- a/pkgs/tools/misc/coreutils/default.nix +++ b/pkgs/tools/misc/coreutils/default.nix @@ -98,7 +98,7 @@ stdenv.mkDerivation rec { echo "int main() { return 77; }" > gnulib-tests/test-parse-datetime.c echo "int main() { return 77; }" > gnulib-tests/test-getlogin.c '' - ])) + (optionalString stdenv.isAarch64 '' + ])) + (optionalString stdenv.hostPlatform.isAarch64 '' # Sometimes fails: https://github.com/NixOS/nixpkgs/pull/143097#issuecomment-954462584 sed '2i echo Skipping cut huge range test && exit 77' -i ./tests/cut/cut-huge-range.sh ''); @@ -135,7 +135,7 @@ stdenv.mkDerivation rec { ++ optional withPrefix "--program-prefix=g" # the shipped configure script doesn't enable nls, but using autoreconfHook # does so which breaks the build - ++ optional stdenv.isDarwin "--disable-nls" + ++ optional stdenv.hostPlatform.isDarwin "--disable-nls" ++ optionals (isCross && stdenv.hostPlatform.libc == "glibc") [ # TODO(19b98110126fde7cbb1127af7e3fe1568eacad3d): Needed for fstatfs() I # don't know why it is not properly detected cross building with glibc. @@ -154,7 +154,7 @@ stdenv.mkDerivation rec { # With non-standard storeDir: https://github.com/NixOS/nix/issues/512 doCheck = (!isCross) && (stdenv.hostPlatform.libc == "glibc" || stdenv.hostPlatform.libc == "musl") - && !stdenv.isAarch32; + && !stdenv.hostPlatform.isAarch32; # Prevents attempts of running 'help2man' on cross-built binaries. PERL = if isCross then "missing" else null; -- cgit 1.4.1