Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treewide: stdenv.is -> stdenv.hostPlatform.is #356363

Merged
merged 2 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nixos/lib/qemu-common.nix
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ rec {
throwUnsupportedGuestSystem = guestMap:
throw "Unsupported guest system ${guestSystem} for host ${hostSystem}, supported: ${lib.concatStringsSep ", " (lib.attrNames guestMap)}";
in
if hostStdenv.isLinux then
if hostStdenv.hostPlatform.isLinux then
linuxHostGuestMatrix.${guestSystem} or "${qemuPkg}/bin/qemu-kvm"
else
let
Expand Down
86 changes: 44 additions & 42 deletions pkgs/applications/radio/sdrangel/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -69,48 +69,50 @@ stdenv.mkDerivation (finalAttrs: {
wrapQtAppsHook
];

buildInputs = [
airspy
airspyhf
aptdec
boost
cm256cc
codec2
dab_lib
dsdcc
faad2
ffmpeg
fftwFloat
flac
glew
hackrf
hidapi
libbladeRF
libiio
libopus
libpulseaudio
libusb1
limesuite
mbelib
opencv4
qt5compat
qtcharts
qtdeclarative
qtlocation
qtmultimedia
qtscxml
qtserialport
qtspeech
qttools
qtwebsockets
qtwebengine
rtl-sdr
serialdv
sgp4
soapysdr-with-plugins
uhd
zlib
] ++ lib.optionals stdenv.isLinux [ qtwayland ] ++ lib.optionals withSDRplay [ sdrplay ];
buildInputs =
[
airspy
airspyhf
aptdec
boost
cm256cc
codec2
dab_lib
dsdcc
faad2
ffmpeg
fftwFloat
flac
glew
hackrf
hidapi
libbladeRF
libiio
libopus
libpulseaudio
libusb1
limesuite
mbelib
opencv4
qt5compat
qtcharts
qtdeclarative
qtlocation
qtmultimedia
qtscxml
qtserialport
qtspeech
qttools
qtwebsockets
qtwebengine
rtl-sdr
serialdv
sgp4
soapysdr-with-plugins
uhd
zlib
]
++ lib.optionals stdenv.hostPlatform.isLinux [ qtwayland ] ++ lib.optionals withSDRplay [ sdrplay ];

cmakeFlags = [
"-DAPT_DIR=${aptdec}"
Expand Down
2 changes: 1 addition & 1 deletion pkgs/applications/science/misc/root/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ stdenv.mkDerivation rec {

# workaround for
# https://github.com/root-project/root/issues/14778
env.NIX_LDFLAGS = lib.optionalString (!stdenv.isDarwin) "--version-script,${writeText "version.map" "ROOT { global: *; };"}";
env.NIX_LDFLAGS = lib.optionalString (!stdenv.hostPlatform.isDarwin) "--version-script,${writeText "version.map" "ROOT { global: *; };"}";

# To use the debug information on the fly (without installation)
# add the outPath of root.debug into NIX_DEBUG_INFO_DIRS (in PATH-like format)
Expand Down
2 changes: 1 addition & 1 deletion pkgs/build-support/rust/build-rust-package/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ assert useSysroot -> !(args.doCheck or true);

stdenv.mkDerivation ((removeAttrs args [ "depsExtraArgs" "cargoUpdateHook" "cargoLock" ]) // lib.optionalAttrs useSysroot {
RUSTFLAGS = "--sysroot ${sysroot} " + (args.RUSTFLAGS or "");
} // lib.optionalAttrs (stdenv.isDarwin && buildType == "debug") {
} // lib.optionalAttrs (stdenv.hostPlatform.isDarwin && buildType == "debug") {
RUSTFLAGS =
"-C split-debuginfo=packed "
+ lib.optionalString useSysroot "--sysroot ${sysroot} "
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/al/almo/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ stdenv.mkDerivation {
makeFlags = [ "all" ];

# remove darwin-only linker flag on linux
postPatch = lib.optionalString (!stdenv.isDarwin) ''
postPatch = lib.optionalString (!stdenv.hostPlatform.isDarwin) ''
substituteInPlace scripts/pybind.sh \
--replace-fail " -undefined dynamic_lookup" ""
'';
Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/ar/arti/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ rustPlatform.buildRustPackage rec {

buildInputs =
[ sqlite ]
++ lib.optionals stdenv.isLinux [ openssl ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These sneaked back in 5136e37 lol

++ lib.optionals stdenv.isDarwin (
++ lib.optionals stdenv.hostPlatform.isLinux [ openssl ]
++ lib.optionals stdenv.hostPlatform.isDarwin (
with darwin.apple_sdk.frameworks;
[
CoreServices
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ba/backrest/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ buildGoModule {
[
"TestServeIndex" # Fails with handler returned wrong content encoding
]
++ lib.optionals stdenv.isDarwin [
++ lib.optionals stdenv.hostPlatform.isDarwin [
"TestBackup" # relies on ionice
];
in
Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/bi/binsider/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ rustPlatform.buildRustPackage rec {

cargoHash = "sha256-EGqoHMkBPIhKV/PozArQ62bH/Gqc92S6ZabTjmIbQeE=";

buildNoDefaultFeatures = !stdenv.isLinux;
buildNoDefaultFeatures = !stdenv.hostPlatform.isLinux;

buildInputs = lib.optionals stdenv.isDarwin (
buildInputs = lib.optionals stdenv.hostPlatform.isDarwin (
with darwin.apple_sdk.frameworks;
[
AppKit
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/bi/bitwarden-desktop/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ in buildNpmPackage rec {
mkdir $out
pushd apps/desktop/dist/linux-${lib.optionalString stdenv.isAarch64 "arm64-"}unpacked
pushd apps/desktop/dist/linux-${lib.optionalString stdenv.hostPlatform.isAarch64 "arm64-"}unpacked
mkdir -p $out/opt/Bitwarden
cp -r locales resources{,.pak} $out/opt/Bitwarden
popd
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ca/cargo-tauri/test-app.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ stdenv.mkDerivation (finalAttrs: {

buildInputs =
[ openssl ]
++ lib.optionals stdenv.isLinux [
++ lib.optionals stdenv.hostPlatform.isLinux [
glib-networking
libayatana-appindicator
webkitgtk_4_1
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ch/chatd/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ buildNpmPackage rec {
makeWrapper
electron
pkg-config
] ++ lib.optional stdenv.isLinux autoPatchelfHook; # for onnx libs
] ++ lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook; # for onnx libs

buildInputs = [
(lib.getLib stdenv.cc.cc) # for libstdc++.so, required by onnxruntime
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/co/conserve/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rustPlatform.buildRustPackage rec {

cargoHash = "sha256-IP9x3n5RdI+TKOhMBWEfw9P2CROcC0SmEsmMVaXjiDE=";

buildInputs = lib.optionals (stdenv.isDarwin) [
buildInputs = lib.optionals (stdenv.hostPlatform.isDarwin) [
darwin.apple_sdk.frameworks.Security
];

Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/co/copycat/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ rustPlatform.buildRustPackage rec {

cargoHash = "sha256-oNX1MUpOjRG02FHOU7zpktLAYKu/1+R2d96jC/VA0co=";

buildInputs = lib.optionals (stdenv.isDarwin) [
buildInputs = lib.optionals (stdenv.hostPlatform.isDarwin) [
darwin.apple_sdk_11_0.frameworks.AppKit
];

Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/cy/cyrus-imapd/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ stdenv.mkDerivation (finalAttrs: {
bison
libsrs2
]
++ lib.optionals stdenv.isLinux [ libcap ]
++ lib.optionals stdenv.hostPlatform.isLinux [ libcap ]
++ lib.optionals (enableHttp || enableCalalarmd || enableJMAP) [
brotli.dev
libical.dev
Expand Down Expand Up @@ -130,7 +130,7 @@ stdenv.mkDerivation (finalAttrs: {
cyrus_sasl
]
# Darwin doesn't have libuuid, try to build without it
++ lib.optional (!stdenv.isDarwin) libuuid;
++ lib.optional (!stdenv.hostPlatform.isDarwin) libuuid;
imapLibs = managesieveLibs ++ [ pcre2 ];
mkLibsString = lib.strings.concatMapStringsSep " " (l: "-L${lib.getLib l}/lib");
in
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/du/dut/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ stdenv.mkDerivation {

meta = {
platforms = lib.platforms.all;
broken = stdenv.isDarwin;
broken = stdenv.hostPlatform.isDarwin;
description = "A disk usage calculator for Linux";
homepage = "https://codeberg.org/201984/dut";
license = lib.licenses.gpl3;
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/en/ente-cli/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ buildGoModule {

passthru = {
# only works on linux, see comment above about ENTE_CLI_SECRETS_PATH on darwin
tests.version = lib.optionalAttrs stdenv.isLinux (
tests.version = lib.optionalAttrs stdenv.hostPlatform.isLinux (
testers.testVersion {
package = ente-cli;
command = ''
Expand Down
7 changes: 5 additions & 2 deletions pkgs/by-name/er/erlang-language-platform/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
autoPatchelfHook,
}:
let
arch = if stdenv.isAarch64 then "aarch64" else "x86_64";
arch = if stdenv.hostPlatform.isAarch64 then "aarch64" else "x86_64";
release =
if stdenv.isDarwin then "macos-${arch}-apple-darwin" else "linux-${arch}-unknown-linux-gnu";
if stdenv.hostPlatform.isDarwin then
"macos-${arch}-apple-darwin"
else
"linux-${arch}-unknown-linux-gnu";

hashes = {
linux-aarch64-unknown-linux-gnu = "sha256-vWMrq/uFU/uyuDnsxZK0ZyvtraVCZwvGjzO1a5QjR8g=";
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ex/exo/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ python3Packages.buildPythonApplication {
];

# Tests require `mlx` which is not supported on linux.
doCheck = stdenv.isDarwin;
doCheck = stdenv.hostPlatform.isDarwin;

passthru = {
updateScript = unstableGitUpdater {
Expand Down
18 changes: 9 additions & 9 deletions pkgs/by-name/fi/fido2-manage/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ stdenv.mkDerivation rec {
pkg-config
cmake
]
++ lib.optionals stdenv.isLinux [
++ lib.optionals stdenv.hostPlatform.isLinux [
copyDesktopItems
imagemagick
];
Expand All @@ -60,12 +60,12 @@ stdenv.mkDerivation rec {
openssl
zlib
]
++ lib.optionals stdenv.isLinux [
++ lib.optionals stdenv.hostPlatform.isLinux [
xterm
udev
pcsclite
]
++ lib.optionals stdenv.isDarwin [
++ lib.optionals stdenv.hostPlatform.isDarwin [
libuv
libsolv
libcouchbase
Expand All @@ -80,23 +80,23 @@ stdenv.mkDerivation rec {
substituteInPlace ./src/libfido2.pc.in \
--replace-fail "\''${prefix}/@CMAKE_INSTALL_LIBDIR@" "@CMAKE_INSTALL_FULL_LIBDIR@"
''
+ lib.optionalString stdenv.isDarwin ''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace ./CMakeLists.txt \
--replace-fail "/\''${CMAKE_INSTALL_LIBDIR}" "/lib"
'';

postInstall =
lib.optionalString stdenv.isLinux ''
lib.optionalString stdenv.hostPlatform.isLinux ''
install $src/fido2-manage.sh $out/bin/fido2-manage
magick ${icon} -background none -gravity center -extent 512x512 token2.png
install -Dm444 token2.png $out/share/icons/hicolor/512x512/apps/token2.png
install $src/gui.py $out/bin/fido2-manage-gui
''
+ lib.optionalString stdenv.isDarwin ''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
install $src/fido2-manage-mac.sh $out/bin/fido2-manage
'';

desktopItems = lib.optionals stdenv.isLinux [
desktopItems = lib.optionals stdenv.hostPlatform.isLinux [
(makeDesktopItem rec {
desktopName = "Fido2 Manager";
name = "fido2-manage";
Expand All @@ -116,7 +116,7 @@ stdenv.mkDerivation rec {
--replace-fail "./fido2-manage.sh" "fido2-manage" \
--replace-fail "awk" "${gawk}/bin/awk"
''
+ lib.optionalString stdenv.isLinux ''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace $out/bin/fido2-manage-gui \
--replace-fail "./fido2-manage.sh" "$out/bin/fido2-manage" \
--replace-fail "x-terminal-emulator" "${xterm}/bin/xterm" \
Expand All @@ -128,7 +128,7 @@ stdenv.mkDerivation rec {

sed -i '1i #!${pythonEnv.interpreter}' $out/bin/fido2-manage-gui
''
+ lib.optionalString stdenv.isDarwin ''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace $out/bin/fido2-manage \
--replace-fail "ggrep" "${gnugrep}/bin/grep"
'';
Expand Down
2 changes: 1 addition & 1 deletion pkgs/by-name/ga/gapcast/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ buildGoModule rec {
license = lib.licenses.gpl2Only;
maintainers = with lib.maintainers; [ fab ];
mainProgram = "gapcast";
broken = stdenv.isDarwin;
broken = stdenv.hostPlatform.isDarwin;
};
}
6 changes: 3 additions & 3 deletions pkgs/by-name/gm/gmt/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ stdenv.mkDerivation (finalAttrs: {
NIX_CFLAGS_COMPILE =
lib.optionalString stdenv.cc.isClang "-Wno-implicit-function-declaration "
+ lib.optionalString (
stdenv.isDarwin
stdenv.hostPlatform.isDarwin
&& lib.versionOlder (darwin.apple_sdk.MacOSX-SDK.version or darwin.apple_sdk.sdk.version) "13.3"
) "-D__LAPACK_int=int";
};
Expand All @@ -49,7 +49,7 @@ stdenv.mkDerivation (finalAttrs: {
gshhg-gmt
]
++ (
if stdenv.isDarwin then
if stdenv.hostPlatform.isDarwin then
with darwin.apple_sdk.frameworks;
[
Accelerate
Expand Down Expand Up @@ -83,7 +83,7 @@ stdenv.mkDerivation (finalAttrs: {
(lib.cmakeBool "GMT_INSTALL_MODULE_LINKS" false)
(lib.cmakeFeature "LICENSE_RESTRICTED" "LGPL")
]
++ (lib.optionals (!stdenv.isDarwin) [
++ (lib.optionals (!stdenv.hostPlatform.isDarwin) [
(lib.cmakeFeature "FFTW3_ROOT" "${fftwSinglePrec.dev}")
(lib.cmakeFeature "LAPACK_LIBRARY" "${lib.getLib lapack}/lib/liblapack.so")
(lib.cmakeFeature "BLAS_LIBRARY" "${lib.getLib blas}/lib/libblas.so")
Expand Down
4 changes: 2 additions & 2 deletions pkgs/by-name/go/gomanagedocker/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ buildGoModule {
vendorHash = "sha256-M/jfQWCBrv7hZm450yLBmcjWtNSCziKOpfipxI6U9ak=";

buildInputs =
lib.optionals stdenv.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]
++ lib.optionals stdenv.isLinux [ xorg.libX11 ];
lib.optionals stdenv.hostPlatform.isDarwin [ darwin.apple_sdk.frameworks.Cocoa ]
++ lib.optionals stdenv.hostPlatform.isLinux [ xorg.libX11 ];

ldflags = [
"-s"
Expand Down
Loading