treewide: replace stdenv.is with stdenv.hostPlatform.is (#413977)

This commit is contained in:
Philip Taron 2025-06-05 06:40:30 -07:00 committed by GitHub
commit 0861217ca8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
44 changed files with 65 additions and 60 deletions

View file

@ -569,7 +569,7 @@ import ../make-test-python.nix (
shutdown_queue.task_done()
threading.Thread(target=shutdown_worker, daemon=True).start()
${pkgs.lib.optionalString pkgs.stdenv.isx86_64 ''
${pkgs.lib.optionalString pkgs.stdenv.hostPlatform.isx86_64 ''
# Only run the MySQL tests on x86_64 so we don't have to debug MySQL ARM issues.
run_mattermost_tests(
shutdown_queue,

View file

@ -208,7 +208,7 @@ stdenv.mkDerivation {
mainProgram = "actual-server";
license = lib.licenses.mit;
# https://github.com/NixOS/nixpkgs/issues/403846
broken = stdenv.isDarwin;
broken = stdenv.hostPlatform.isDarwin;
maintainers = [
lib.maintainers.oddlama
lib.maintainers.patrickdag

View file

@ -26,7 +26,7 @@ stdenv.mkDerivation (finalAttrs: {
];
# Can't find libdispatch without this on NixOS. (swift 5.8)
LD_LIBRARY_PATH = lib.optionalString stdenv.isLinux "${swiftPackages.Dispatch}/lib";
LD_LIBRARY_PATH = lib.optionalString stdenv.hostPlatform.isLinux "${swiftPackages.Dispatch}/lib";
postPatch =
let

View file

@ -41,7 +41,7 @@ stdenv.mkDerivation (finalAttrs: {
python3
git
libsass
] ++ lib.optional stdenv.isDarwin xcbuild;
] ++ lib.optional stdenv.hostPlatform.isDarwin xcbuild;
configurePhase = ''
runHook preConfigure

View file

@ -37,6 +37,6 @@ rustPlatform.buildRustPackage rec {
license = licenses.mit;
maintainers = with maintainers; [ fab ];
mainProgram = "ares";
broken = stdenv.isDarwin;
broken = stdenv.hostPlatform.isDarwin;
};
}

View file

@ -45,6 +45,6 @@ rustPlatform.buildRustPackage rec {
license = lib.licenses.agpl3Only;
maintainers = with lib.maintainers; [ fab ];
mainProgram = "arp-scan";
broken = stdenv.isDarwin;
broken = stdenv.hostPlatform.isDarwin;
};
}

View file

@ -34,16 +34,16 @@ buildDotnetModule rec {
dotnet-sdk = dotnetCorePackages.sdk_8_0;
dotnet-runtime = dotnetCorePackages.runtime_8_0;
nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ];
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
buildInputs = lib.optionals stdenv.isLinux [
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
icu
libkrb5
openssl
stdenv.cc.cc.lib
];
doCheck = !(stdenv.isDarwin && stdenv.isAarch64); # mono is not available on aarch64-darwin
doCheck = !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64); # mono is not available on aarch64-darwin
meta = {
description = "Domain Specific Language (DSL) for deploying Azure resources declaratively";

View file

@ -37,7 +37,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
buildInputs = [
libpulseaudio
openssl
] ++ lib.optionals stdenv.isLinux [ alsa-lib ];
] ++ lib.optionals stdenv.hostPlatform.isLinux [ alsa-lib ];
passthru.updateScript = nix-update-script { extraArgs = [ "--generate-lockfile" ]; };

View file

@ -15,7 +15,7 @@ rustPlatform.buildRustPackage rec {
hash = "sha256-FS1WFlK0YNq1QCi3S3f5tMN+Bdcfx2dxhDKRLXLcios=";
};
buildInputs = lib.optional stdenv.isDarwin libz;
buildInputs = lib.optional stdenv.hostPlatform.isDarwin libz;
useFetchCargoVendor = true;
cargoHash = "sha256-E/yF42Vx9tv8Ik1j23El3+fI19ZGzq6nikVMATY7m3E=";

View file

@ -19,7 +19,7 @@ buildGoModule rec {
vendorHash = null;
checkFlags = lib.optional stdenv.isDarwin "-skip=^Test_firstSuccessfulProbe$";
checkFlags = lib.optional stdenv.hostPlatform.isDarwin "-skip=^Test_firstSuccessfulProbe$";
meta = {
description = "Load Balancer implementation for Kubernetes-in-Docker";

View file

@ -118,7 +118,7 @@ stdenv.mkDerivation (finalAttrs: {
versionCheckProgramArg = "--version";
passthru = {
tests = lib.optionalAttrs stdenv.isLinux {
tests = lib.optionalAttrs stdenv.hostPlatform.isLinux {
inherit (nixosTests) fluent-bit;
};

View file

@ -42,7 +42,7 @@ stdenv.mkDerivation rec {
./info-fix.patch
];
nativeBuildInputs = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
nativeBuildInputs = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
makeBinaryWrapper
darwin.sigtool
];
@ -60,7 +60,7 @@ stdenv.mkDerivation rec {
'';
preFixup =
lib.optionalString stdenv.isLinux ''
lib.optionalString stdenv.hostPlatform.isLinux ''
find $out -type f | while read f; do
patchelf "$f" > /dev/null 2>&1 || continue
patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true
@ -74,7 +74,7 @@ stdenv.mkDerivation rec {
} "$f" || true
done
''
+ lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
+ lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) ''
find "$out" -executable -type f | while read executable; do
( \
install_name_tool \

View file

@ -36,7 +36,7 @@ stdenv.mkDerivation rec {
.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
};
nativeBuildInputs = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
nativeBuildInputs = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
makeBinaryWrapper
darwin.sigtool
];
@ -60,7 +60,7 @@ stdenv.mkDerivation rec {
'';
preFixup =
lib.optionalString stdenv.isLinux ''
lib.optionalString stdenv.hostPlatform.isLinux ''
find $out -type f | while read f; do
patchelf "$f" > /dev/null 2>&1 || continue
patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true
@ -76,7 +76,7 @@ stdenv.mkDerivation rec {
} "$f" || true
done
''
+ lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) ''
+ lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) ''
find "$out" -executable -type f | while read executable; do
( \
install_name_tool \

View file

@ -27,7 +27,7 @@ stdenv.mkDerivation (finalAttrs: {
postPatch = ''
patchShebangs examples/test_c_child_requires_c_no_deps.bash
substituteInPlace examples/CMakeLists.txt --replace-fail \
"$""{CMAKE_INSTALL_LIBDIR}" "${if stdenv.isDarwin then "lib" else "lib64"}"
"$""{CMAKE_INSTALL_LIBDIR}" "${if stdenv.hostPlatform.isDarwin then "lib" else "lib64"}"
'';
nativeBuildInputs = [

View file

@ -31,6 +31,6 @@ buildGoModule rec {
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ fab ];
mainProgram = "http-scanner";
broken = stdenv.isDarwin;
broken = stdenv.hostPlatform.isDarwin;
};
}

View file

@ -37,7 +37,7 @@ let
];
};
in
if stdenv.isLinux then
if stdenv.hostPlatform.isLinux then
buildFHSEnv {
inherit meta pname version;
targetPkgs = pkgs: [ pkgs.zlib ];

View file

@ -25,7 +25,7 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-izjZk2kz9PkLm9+INUdl1e7jMz3nUsQKdplKI9Io+CM=";
};
env = lib.optionalAttrs stdenv.is32bit {
env = lib.optionalAttrs stdenv.hostPlatform.is32bit {
NIX_CFLAGS_COMPILE = "-D_LARGEFILE64_SOURCE";
};

View file

@ -18,9 +18,9 @@ stdenv.mkDerivation rec {
hash = "sha256-sMgYgV4/vV1x5xSICXRpW6K8uCdVlJrS7iEg6XzQRo8=";
};
patches = lib.optionals stdenv.isDarwin [ ./no-lrt.patch ];
patches = lib.optionals stdenv.hostPlatform.isDarwin [ ./no-lrt.patch ];
makeFlags = lib.optionals stdenv.isDarwin [
makeFlags = lib.optionals stdenv.hostPlatform.isDarwin [
"CC=cc"
"LD=clang"
];

View file

@ -17,7 +17,7 @@ stdenv.mkDerivation rec {
sha256 = "sha256-oydS7FubUniMHAUWfg84OH9+CZ0JCrTXy7jzwOyJzC8=";
};
patches = lib.optionals stdenv.isDarwin [
patches = lib.optionals stdenv.hostPlatform.isDarwin [
./0001-ignore-obstack_free-alias-on-darwin.patch
];

View file

@ -39,7 +39,7 @@ let
dhcpcd
passt
(placeholder "out")
] ++ lib.optionals stdenv.isAarch64 [ fex ];
] ++ lib.optionals stdenv.hostPlatform.isAarch64 [ fex ];
wrapArgs = lib.escapeShellArgs [
"--prefix"
"PATH"
@ -72,7 +72,7 @@ rustPlatform.buildRustPackage rec {
--replace-fail "/sbin/sysctl" "${lib.getExe' procps "sysctl"}"
''
# Only patch FEX path if we're aarch64, otherwise we don't want the derivation to pull in FEX in any way
+ lib.optionalString stdenv.isAarch64 ''
+ lib.optionalString stdenv.hostPlatform.isAarch64 ''
substituteInPlace crates/muvm/src/guest/mount.rs \
--replace-fail "/usr/share/fex-emu" "${fex}/share/fex-emu"
'';

View file

@ -5,7 +5,7 @@
bash,
makeWrapper,
pciutils,
x11Support ? !stdenvNoCC.isOpenBSD,
x11Support ? !stdenvNoCC.hostPlatform.isOpenBSD,
ueberzug,
fetchpatch,
}:
@ -56,7 +56,9 @@ stdenvNoCC.mkDerivation {
postInstall = ''
wrapProgram $out/bin/neofetch \
--prefix PATH : ${
lib.makeBinPath (lib.optional (!stdenvNoCC.isOpenBSD) pciutils ++ lib.optional x11Support ueberzug)
lib.makeBinPath (
lib.optional (!stdenvNoCC.hostPlatform.isOpenBSD) pciutils ++ lib.optional x11Support ueberzug
)
}
'';

View file

@ -55,7 +55,7 @@ let
passthru.updateScript = ./update.sh;
in
if stdenvNoCC.isDarwin then
if stdenvNoCC.hostPlatform.isDarwin then
stdenvNoCC.mkDerivation {
inherit
pname

View file

@ -341,7 +341,7 @@ stdenv.mkDerivation (final: {
];
platforms = builtins.attrNames ovftoolSystems;
mainProgram = "ovftool";
knownVulnerabilities = lib.optionals (stdenv.isDarwin) [
knownVulnerabilities = lib.optionals (stdenv.hostPlatform.isDarwin) [
"The bundled version of openssl 1.0.2zj in ovftool for Darwin has open vulnerabilities."
"https://openssl-library.org/news/vulnerabilities-1.0.2/"
"CVE-2024-0727"

View file

@ -13,7 +13,7 @@ stdenv.mkDerivation rec {
cmake
ninja
];
buildInputs = lib.optionals (stdenv.isLinux) [ stdenv.cc.libc.static ];
buildInputs = lib.optionals (stdenv.hostPlatform.isLinux) [ stdenv.cc.libc.static ];
src = fetchFromGitHub {
owner = "0vercl0k";
@ -25,7 +25,7 @@ stdenv.mkDerivation rec {
installPhase = ''
mkdir -p $out/bin
cp rp-${if stdenv.isDarwin then "osx" else "lin"} $out/bin/rp
cp rp-${if stdenv.hostPlatform.isDarwin then "osx" else "lin"} $out/bin/rp
'';
meta = with lib; {

View file

@ -101,7 +101,7 @@ buildDotnetModule rec {
"--set SDL_VIDEODRIVER x11"
];
preInstall = lib.optionalString stdenv.isLinux ''
preInstall = lib.optionalString stdenv.hostPlatform.isLinux ''
# workaround for https://github.com/Ryujinx/Ryujinx/issues/2349
mkdir -p $out/lib/sndio-6
ln -s ${sndio}/lib/libsndio.so $out/lib/sndio-6/libsndio.so.6

View file

@ -56,7 +56,7 @@ rustPlatform.buildRustPackage (finalAttrs: {
"--skip=pdl_is_fresh"
"--skip=verify_revision_available"
]
++ lib.optionals stdenv.isDarwin [
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Sandbox limitation: attempted to create a NULL object
"--skip=website::test_link_duplicates"
"--skip=website::not_crawl_blacklist"

View file

@ -13,7 +13,7 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-7gioQ0r0LlUftIWKRwTqeZQl0GtskcRKaEE5z6A0S24=";
};
postPatch = lib.optionalString stdenv.isDarwin ''
postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace Makefile --replace-fail "-Wl,-z,relro,-z,now" ""
'';

View file

@ -57,8 +57,8 @@ let
in
"[${lib.concatStringsSep "," options}]";
LANG = if stdenv.isLinux then "C.UTF-8" else "C";
LC_CTYPE = if stdenv.isLinux then "C.UTF-8" else "UTF-8";
LANG = if stdenv.hostPlatform.isLinux then "C.UTF-8" else "C";
LC_CTYPE = if stdenv.hostPlatform.isLinux then "C.UTF-8" else "UTF-8";
# add to ERL_LIBS so other modules can find at runtime.
# http://erlang.org/doc/man/code.html#code-path

View file

@ -138,8 +138,8 @@ stdenv.mkDerivation (
in
"[${lib.concatStringsSep "," options}]";
LANG = if stdenv.isLinux then "C.UTF-8" else "C";
LC_CTYPE = if stdenv.isLinux then "C.UTF-8" else "UTF-8";
LANG = if stdenv.hostPlatform.isLinux then "C.UTF-8" else "C";
LC_CTYPE = if stdenv.hostPlatform.isLinux then "C.UTF-8" else "UTF-8";
postUnpack =
''

View file

@ -162,10 +162,13 @@ let
runHook postInstall
'';
${if stdenvNoCC.isDarwin && lib.versionAtLeast version "10" then "postInstall" else null} = ''
mkdir -p "$out"/nix-support
cp "$src"/nix-support/manual-sdk-deps "$out"/nix-support/manual-sdk-deps
'';
${
if stdenvNoCC.hostPlatform.isDarwin && lib.versionAtLeast version "10" then "postInstall" else null
} =
''
mkdir -p "$out"/nix-support
cp "$src"/nix-support/manual-sdk-deps "$out"/nix-support/manual-sdk-deps
'';
passthru = {
inherit (vmr) icu targetRid hasILCompiler;

View file

@ -18,7 +18,7 @@ let
writeShellScript
;
inherit pkgs nodejs;
libtool = if pkgs.stdenv.isDarwin then pkgs.cctools or pkgs.darwin.cctools else null;
libtool = if pkgs.stdenv.hostPlatform.isDarwin then pkgs.cctools or pkgs.darwin.cctools else null;
};
in
import ./node-packages.nix {

View file

@ -25,7 +25,7 @@ qtModule {
];
strictDeps = true;
nativeBuildInputs = lib.optionals stdenv.isDarwin [
nativeBuildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
darwin.sigtool
];

View file

@ -15922,7 +15922,7 @@ lib.makeScope pkgs.newScope (self: {
meta = {
hydraPlatforms = [ ];
# darwin cannot find libpango.dylib
broken = stdenv.isDarwin;
broken = stdenv.hostPlatform.isDarwin;
};
}
);
@ -39541,7 +39541,7 @@ lib.makeScope pkgs.newScope (self: {
meta = {
hydraPlatforms = [ ];
# darwin cannot find libpango.dylib
broken = stdenv.isDarwin;
broken = stdenv.hostPlatform.isDarwin;
};
}
);

View file

@ -23,7 +23,7 @@ deployAndroidPackage {
pkgs.ncurses5
pkgs.libcxx
]
++ lib.optionals (os == "linux" && stdenv.isx86_64) (
++ lib.optionals (os == "linux" && stdenv.hostPlatform.isx86_64) (
with pkgsi686Linux;
[
glibc

View file

@ -29,7 +29,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
finalAttrs.passthru.sources.${stdenvNoCC.hostPlatform.system}
or (throw "Unsupported platform for tideways-php: ${stdenvNoCC.hostPlatform.system}");
nativeBuildInputs = lib.optionals stdenvNoCC.isLinux [
nativeBuildInputs = lib.optionals stdenvNoCC.hostPlatform.isLinux [
autoPatchelfHook
];

View file

@ -58,7 +58,7 @@ buildPythonPackage {
transformers
];
# `deepspeed` is not yet packaged in nixpkgs
# ++ lib.optionals (!stdenv.isDarwin) [
# ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
# deepspeed
# ];
};

View file

@ -119,7 +119,7 @@ buildPythonPackage rec {
cmakeConfigurePhase
cmake --build native/src/build --config Release
''
+ lib.optionalString (enableRemoting && stdenv.isLinux) ''
+ lib.optionalString (enableRemoting && stdenv.hostPlatform.isLinux) ''
# reimplementation of native/build_remoting.py
cmakeFlags="-S native/remoting -B remoting/linux64 -D RPCLIB=${rpclib}"
cmakeConfigurePhase

View file

@ -71,7 +71,7 @@ buildPythonPackage rec {
pytestFlagsArray = [ "tests" ];
# These tests fail when MPS devices are detected
disabledTests = lib.optional stdenv.isDarwin [
disabledTests = lib.optional stdenv.hostPlatform.isDarwin [
"gpu"
];

View file

@ -46,7 +46,7 @@ buildPythonPackage rec {
];
# numerous test failures on Darwin
doCheck = stdenv.isLinux;
doCheck = stdenv.hostPlatform.isLinux;
pythonImportsCheck = [ "prometheus_fastapi_instrumentator" ];

View file

@ -61,7 +61,7 @@ buildPythonPackage rec {
__impureHostDeps = [ "/System/Library/Fonts" ];
postCheck = ''
export LANG=${if stdenv.isDarwin then "en_US.UTF-8" else "C.UTF-8"}
export LANG=${if stdenv.hostPlatform.isDarwin then "en_US.UTF-8" else "C.UTF-8"}
'';
meta = with lib; {

View file

@ -132,7 +132,7 @@ buildPythonPackage rec {
"test_visit_webpage"
"test_wikipedia_search"
]
++ lib.optionals stdenv.isDarwin [
++ lib.optionals stdenv.hostPlatform.isDarwin [
# Missing dependencies
"test_get_mlx"

View file

@ -295,7 +295,7 @@ buildPythonPackage rec {
lib.optionals cpuSupport [
oneDNN
]
++ lib.optionals (cpuSupport && stdenv.isLinux) [
++ lib.optionals (cpuSupport && stdenv.hostPlatform.isLinux) [
numactl
]
++ lib.optionals cudaSupport (

View file

@ -10,7 +10,7 @@
ffmpeg-headless,
# Current derivation only supports linux-x86_64 (contributions welcome, without libTensorflow builtin webassembly can be used)
useLibTensorflow ? stdenv.isx86_64 && stdenv.isLinux,
useLibTensorflow ? stdenv.hostPlatform.isx86_64 && stdenv.hostPlatform.isLinux,
ncVersion,
}:

View file

@ -25,7 +25,7 @@ stdenv.mkDerivation (finalAttrs: {
zip
wrapQtAppsHook
];
patches = lib.optionals stdenv.isDarwin [ ./bundle-destination.patch ];
patches = lib.optionals stdenv.hostPlatform.isDarwin [ ./bundle-destination.patch ];
meta = {
description = "UEFI firmware image viewer and editor";