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"
```
This commit is contained in:
Artturin
2024-09-25 00:04:37 +03:00
parent aaa7fb5840
commit e0464e4788
4283 changed files with 8137 additions and 8137 deletions
@@ -1,7 +1,7 @@
{ lib, stdenv, cffi }:
if cffi == null then null else cffi.overridePythonAttrs {
disabledTests = lib.optionals stdenv.isDarwin [
disabledTests = lib.optionals stdenv.hostPlatform.isDarwin [
# cannot load library 'c'
"test_FILE"
"test_FILE_object"
@@ -15,7 +15,7 @@ buildPythonPackage rec {
nativeBuildInputs = [ setuptools-scm ];
preConfigure = ''
export LC_ALL=${if stdenv.isDarwin then "en_US" else "C"}.UTF-8
export LC_ALL=${if stdenv.hostPlatform.isDarwin then "en_US" else "C"}.UTF-8
'';
meta = with lib; {
@@ -16,7 +16,7 @@ buildPythonPackage rec {
${python.interpreter} test_futures.py
'';
doCheck = !stdenv.isDarwin;
doCheck = !stdenv.hostPlatform.isDarwin;
meta = with lib; {
description = "Backport of the concurrent.futures package from Python 3.2";
@@ -22,7 +22,7 @@ buildPythonPackage rec {
# Multiple tests run out of stack space on 32bit systems with python2.
# See https://github.com/pallets/jinja/issues/1158
# warnings are no longer being filtered correctly for python2
doCheck = !stdenv.is32bit && isPy3k;
doCheck = !stdenv.hostPlatform.is32bit && isPy3k;
checkPhase = ''
pytest -v tests -W ignore::DeprecationWarning
@@ -13,7 +13,7 @@ buildPythonPackage rec {
outputs = [ "out" "devdoc" ];
patches = lib.optionals stdenv.isDarwin [
patches = lib.optionals stdenv.hostPlatform.isDarwin [
./pygobject-2.0-fix-darwin.patch
(fetchpatch {
url = "https://github.com/macports/macports-ports/raw/f2975d5bbbc2459c661905c5a850cc661fa32f55/python/py-gobject/files/py-gobject-dynamic_lookup-11.patch";
@@ -37,8 +37,8 @@ buildPythonPackage rec {
buildPhase = "buildPhase";
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-ObjC"
+ lib.optionalString (stdenv.isDarwin && stdenv.isAarch64) " -lpython2.7";
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-ObjC"
+ lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) " -lpython2.7";
installPhase = "installPhase";