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:
@@ -137,14 +137,14 @@ let
|
||||
revert = true;
|
||||
hash = "sha256-Lp5fGlcfJJ6p6vKmcLckJiAA2AZz4prjFE0aMEJxotw=";
|
||||
})
|
||||
] ++ lib.optionals (x11Support && stdenv.isDarwin) [
|
||||
] ++ lib.optionals (x11Support && stdenv.hostPlatform.isDarwin) [
|
||||
./use-correct-tcl-tk-on-darwin.patch
|
||||
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
# Fix darwin build https://bugs.python.org/issue34027
|
||||
../3.7/darwin-libutil.patch
|
||||
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
] ++ lib.optionals stdenv.hostPlatform.isLinux [
|
||||
|
||||
# Disable the use of ldconfig in ctypes.util.find_library (since
|
||||
# ldconfig doesn't work on NixOS), and don't use
|
||||
@@ -188,7 +188,7 @@ let
|
||||
for i in Lib/plat-*/regen; do
|
||||
substituteInPlace $i --replace /usr/include/ ${stdenv.cc.libc}/include/
|
||||
done
|
||||
'' + lib.optionalString stdenv.isDarwin ''
|
||||
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
||||
substituteInPlace configure --replace '`/usr/bin/arch`' '"i386"'
|
||||
substituteInPlace Lib/multiprocessing/__init__.py \
|
||||
--replace 'os.popen(comm)' 'os.popen("${coreutils}/bin/nproc")'
|
||||
@@ -205,7 +205,7 @@ let
|
||||
"--enable-unicode=ucs${toString ucsEncoding}"
|
||||
] ++ lib.optionals stdenv.hostPlatform.isCygwin [
|
||||
"ac_cv_func_bind_textdomain_codeset=yes"
|
||||
] ++ lib.optionals stdenv.isDarwin [
|
||||
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
|
||||
"--disable-toolbox-glue"
|
||||
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
|
||||
"PYTHON_FOR_BUILD=${lib.getBin buildPackages.python}/bin/python"
|
||||
@@ -240,7 +240,7 @@ let
|
||||
lib.optional (stdenv ? cc && stdenv.cc.libc != null) stdenv.cc.libc ++
|
||||
[ bzip2 openssl zlib libffi expat db gdbm ncurses sqlite readline ]
|
||||
++ lib.optionals x11Support [ tcl tk libX11 ]
|
||||
++ lib.optional (stdenv.isDarwin && configd != null) configd;
|
||||
++ lib.optional (stdenv.hostPlatform.isDarwin && configd != null) configd;
|
||||
nativeBuildInputs =
|
||||
[ autoreconfHook ]
|
||||
++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform)
|
||||
@@ -264,7 +264,7 @@ in with passthru; stdenv.mkDerivation ({
|
||||
|
||||
inherit src patches buildInputs nativeBuildInputs preConfigure configureFlags;
|
||||
|
||||
LDFLAGS = lib.optionalString (!stdenv.isDarwin) "-lgcc_s";
|
||||
LDFLAGS = lib.optionalString (!stdenv.hostPlatform.isDarwin) "-lgcc_s";
|
||||
inherit (mkPaths buildInputs) C_INCLUDE_PATH LIBRARY_PATH;
|
||||
|
||||
env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.targetPlatform.system == "x86_64-darwin") "-msse2"
|
||||
|
||||
Reference in New Issue
Block a user