Skip to content

Commit

Permalink
qt6: replace stdenv.is* with stdenv.hostPlatform.is*
Browse files Browse the repository at this point in the history
  • Loading branch information
NickCao authored and bjornfor committed Feb 20, 2024
1 parent cc0531b commit 73e9155
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 38 deletions.
6 changes: 3 additions & 3 deletions pkgs/development/libraries/qt-6/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let
callPackage = self.newScope ({
inherit (self) qtModule;
inherit srcs python3;
stdenv = if stdenv.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
stdenv = if stdenv.hostPlatform.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv;
});
in
{
Expand Down Expand Up @@ -109,7 +109,7 @@ let
qtwebengine
qtwebsockets
qtwebview
] ++ lib.optionals (!stdenv.isDarwin) [ qtwayland libglvnd ])) { };
] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ qtwayland libglvnd ])) { };

qt3d = callPackage ./modules/qt3d.nix { };
qt5compat = callPackage ./modules/qt5compat.nix { };
Expand Down Expand Up @@ -163,7 +163,7 @@ let
MediaAccessibility MediaPlayer MetalKit Network OpenDirectory Quartz
ReplayKit SecurityInterface Vision;
qtModule = callPackage ({ qtModule }: qtModule.override {
stdenv = if stdenv.isDarwin
stdenv = if stdenv.hostPlatform.isDarwin
then overrideSDK stdenv { darwinMinVersion = "10.13"; darwinSdkVersion = "11.0"; }
else stdenv;
}) { };
Expand Down
22 changes: 11 additions & 11 deletions pkgs/development/libraries/qt-6/modules/qtbase.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
, double-conversion
, util-linux
, systemd
, systemdSupport ? stdenv.isLinux
, systemdSupport ? stdenv.hostPlatform.isLinux
, libb2
, md4c
, mtdev
Expand Down Expand Up @@ -87,7 +87,7 @@
, dconf
, gtk3
# options
, libGLSupported ? stdenv.isLinux
, libGLSupported ? stdenv.hostPlatform.isLinux
, libGL
, debug ? false
, developerBuild ? false
Expand Down Expand Up @@ -132,7 +132,7 @@ stdenv.mkDerivation rec {
unixODBCDrivers.mariadb
] ++ lib.optionals systemdSupport [
systemd
] ++ lib.optionals stdenv.isLinux [
] ++ lib.optionals stdenv.hostPlatform.isLinux [
util-linux
mtdev
lksctp-tools
Expand Down Expand Up @@ -165,7 +165,7 @@ stdenv.mkDerivation rec {
xorg.libXtst
xorg.xcbutilcursor
libepoxy
] ++ lib.optionals stdenv.isDarwin [
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
AGL
AVFoundation
AppKit
Expand All @@ -178,9 +178,9 @@ stdenv.mkDerivation rec {

buildInputs = [
at-spi2-core
] ++ lib.optionals (!stdenv.isDarwin) [
] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
libinput
] ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [
] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
AppKit
CoreBluetooth
]
Expand All @@ -191,7 +191,7 @@ stdenv.mkDerivation rec {
++ lib.optional (postgresql != null) postgresql;

nativeBuildInputs = [ bison flex gperf lndir perl pkg-config which cmake xmlstarlet ninja ]
++ lib.optionals stdenv.isDarwin [ moveBuildTree ];
++ lib.optionals stdenv.hostPlatform.isDarwin [ moveBuildTree ];

propagatedNativeBuildInputs = [ lndir ];

Expand All @@ -204,7 +204,7 @@ stdenv.mkDerivation rec {
# https://bugreports.qt.io/browse/QTBUG-97568
postPatch = ''
substituteInPlace src/corelib/CMakeLists.txt --replace-fail "/bin/ls" "${coreutils}/bin/ls"
'' + lib.optionalString stdenv.isDarwin ''
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace cmake/QtPublicAppleHelpers.cmake --replace-fail "/usr/bin/xcrun" "${xcbuild}/bin/xcrun"
'';

Expand All @@ -225,16 +225,16 @@ stdenv.mkDerivation rec {
"-DQT_FEATURE_libproxy=ON"
"-DQT_FEATURE_system_sqlite=ON"
"-DQT_FEATURE_openssl_linked=ON"
] ++ lib.optionals (!stdenv.isDarwin) [
] ++ lib.optionals (!stdenv.hostPlatform.isDarwin) [
"-DQT_FEATURE_sctp=ON"
"-DQT_FEATURE_journald=${if systemdSupport then "ON" else "OFF"}"
"-DQT_FEATURE_vulkan=ON"
] ++ lib.optionals stdenv.isDarwin [
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
# error: 'path' is unavailable: introduced in macOS 10.15
"-DQT_FEATURE_cxx17_filesystem=OFF"
] ++ lib.optional (qttranslations != null) "-DINSTALL_TRANSLATIONSDIR=${qttranslations}/translations";

env.NIX_LDFLAGS = toString (lib.optionals stdenv.isDarwin [
env.NIX_LDFLAGS = toString (lib.optionals stdenv.hostPlatform.isDarwin [
# Undefined symbols for architecture arm64: "___gss_c_nt_hostbased_service_oid_desc"
"-framework GSS"
]);
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/libraries/qt-6/modules/qtconnectivity.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
qtModule {
pname = "qtconnectivity";
nativeBuildInputs = [ pkg-config ];
buildInputs = lib.optionals stdenv.isLinux [ bluez ];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ bluez ];
propagatedBuildInputs = [
qtbase
qtdeclarative
] ++ lib.optionals stdenv.isDarwin [
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
IOBluetooth
PCSC
];
Expand Down
10 changes: 5 additions & 5 deletions pkgs/development/libraries/qt-6/modules/qtmultimedia.nix
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ qtModule {
pname = "qtmultimedia";
nativeBuildInputs = [ pkg-config ];
buildInputs = [ libunwind orc ffmpeg_6 ]
++ lib.optionals stdenv.isLinux [ libpulseaudio elfutils alsa-lib wayland libXrandr libva ];
++ lib.optionals stdenv.hostPlatform.isLinux [ libpulseaudio elfutils alsa-lib wayland libXrandr libva ];
propagatedBuildInputs = [ qtbase qtdeclarative qtsvg qtshadertools qtquick3d ]
++ lib.optionals stdenv.isLinux [ gstreamer gst-plugins-base gst-plugins-good gst-libav gst-vaapi ]
++ lib.optionals stdenv.isDarwin [ VideoToolbox ];
++ lib.optionals stdenv.hostPlatform.isLinux [ gstreamer gst-plugins-base gst-plugins-good gst-libav gst-vaapi ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ VideoToolbox ];

cmakeFlags = [ "-DENABLE_DYNAMIC_RESOLVE_VAAPI_SYMBOLS=0" ];

env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin
env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin
"-include AudioToolbox/AudioToolbox.h";
NIX_LDFLAGS = lib.optionalString stdenv.isDarwin
NIX_LDFLAGS = lib.optionalString stdenv.hostPlatform.isDarwin
"-framework AudioToolbox";
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
qtModule {
pname = "qtquick3dphysics";
propagatedBuildInputs = [ qtbase qtquick3d ];
env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.isDarwin && stdenv.isx86_64)
env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64)
"-faligned-allocation";
}
2 changes: 1 addition & 1 deletion pkgs/development/libraries/qt-6/modules/qtserialport.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
qtModule {
pname = "qtserialport";
nativeBuildInputs = [ pkg-config ];
propagatedBuildInputs = [ qtbase ] ++ lib.optionals stdenv.isLinux [ udev ];
propagatedBuildInputs = [ qtbase ] ++ lib.optionals stdenv.hostPlatform.isLinux [ udev ];
}
4 changes: 2 additions & 2 deletions pkgs/development/libraries/qt-6/modules/qtspeech.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
qtModule {
pname = "qtspeech";
nativeBuildInputs = [ pkg-config ];
buildInputs = lib.optionals stdenv.isLinux [ flite alsa-lib speechd ];
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [ flite alsa-lib speechd ];
propagatedBuildInputs = [ qtbase qtmultimedia ]
++ lib.optionals stdenv.isDarwin [ Cocoa ];
++ lib.optionals stdenv.hostPlatform.isDarwin [ Cocoa ];
}
2 changes: 1 addition & 1 deletion pkgs/development/libraries/qt-6/modules/qttools.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ qtModule {
llvmPackages.llvm
];
propagatedBuildInputs = [ qtbase qtdeclarative ]
++ lib.optionals stdenv.isDarwin [ cups ];
++ lib.optionals stdenv.hostPlatform.isDarwin [ cups ];
patches = [
../patches/qttools-paths.patch
];
Expand Down
18 changes: 9 additions & 9 deletions pkgs/development/libraries/qt-6/modules/qtwebengine.nix
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ qtModule {
which
gn
nodejs
] ++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [
] ++ lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) [
autoSignDarwinBinariesHook
] ++ lib.optionals stdenv.isDarwin [
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
bootstrap_cmds
cctools
xcbuild
Expand Down Expand Up @@ -158,14 +158,14 @@ qtModule {
--replace "QLibraryInfo::path(QLibraryInfo::TranslationsPath)" "\"$out/translations\"" \
--replace "QLibraryInfo::path(QLibraryInfo::LibraryExecutablesPath)" "\"$out/libexec\""
''
+ lib.optionalString stdenv.isLinux ''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
sed -i -e '/lib_loader.*Load/s!"\(libudev\.so\)!"${lib.getLib systemd}/lib/\1!' \
src/3rdparty/chromium/device/udev_linux/udev?_loader.cc
sed -i -e '/libpci_loader.*Load/s!"\(libpci\.so\)!"${pciutils}/lib/\1!' \
src/3rdparty/chromium/gpu/config/gpu_info_collector_linux.cc
''
+ lib.optionalString stdenv.isDarwin ''
+ lib.optionalString stdenv.hostPlatform.isDarwin ''
substituteInPlace configure.cmake src/gn/CMakeLists.txt \
--replace "AppleClang" "Clang"
substituteInPlace cmake/Functions.cmake \
Expand All @@ -190,7 +190,7 @@ qtModule {
# "-DQT_FEATURE_webengine_native_spellchecker=ON"
"-DQT_FEATURE_webengine_sanitizer=ON"
"-DQT_FEATURE_webengine_kerberos=ON"
] ++ lib.optionals stdenv.isLinux [
] ++ lib.optionals stdenv.hostPlatform.isLinux [
"-DQT_FEATURE_webengine_system_libxml=ON"
"-DQT_FEATURE_webengine_webrtc_pipewire=ON"

Expand All @@ -199,7 +199,7 @@ qtModule {
"-DQT_FEATURE_webengine_system_icu=ON"
] ++ lib.optionals enableProprietaryCodecs [
"-DQT_FEATURE_webengine_proprietary_codecs=ON"
] ++ lib.optionals stdenv.isDarwin [
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
"-DCMAKE_OSX_DEPLOYMENT_TARGET=${stdenv.hostPlatform.darwinSdkVersion}"
];

Expand Down Expand Up @@ -232,7 +232,7 @@ qtModule {

libevent
ffmpeg_4
] ++ lib.optionals stdenv.isLinux [
] ++ lib.optionals stdenv.hostPlatform.isLinux [
dbus
zlib
minizip
Expand Down Expand Up @@ -275,7 +275,7 @@ qtModule {

libkrb5
mesa
] ++ lib.optionals stdenv.isDarwin [
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
AGL
AVFoundation
Accelerate
Expand All @@ -302,7 +302,7 @@ qtModule {

buildInputs = [
cups
] ++ lib.optionals stdenv.isDarwin [
] ++ lib.optionals stdenv.hostPlatform.isDarwin [
libpm
sandbox
];
Expand Down
4 changes: 2 additions & 2 deletions pkgs/development/libraries/qt-6/modules/qtwebview.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@
qtModule {
pname = "qtwebview";
propagatedBuildInputs = [ qtdeclarative ]
++ lib.optionals (!stdenv.isDarwin) [ qtwebengine ]
++ lib.optionals stdenv.isDarwin [ WebKit ];
++ lib.optionals (!stdenv.hostPlatform.isDarwin) [ qtwebengine ]
++ lib.optionals stdenv.hostPlatform.isDarwin [ WebKit ];
}
2 changes: 1 addition & 1 deletion pkgs/development/libraries/qt-6/qtModule.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ stdenv.mkDerivation (args // {

buildInputs = args.buildInputs or [ ];
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [ cmake ninja perl ]
++ lib.optionals stdenv.isDarwin [ moveBuildTree ];
++ lib.optionals stdenv.hostPlatform.isDarwin [ moveBuildTree ];
propagatedBuildInputs =
(lib.warnIf (args ? qtInputs) "qt6.qtModule's qtInputs argument is deprecated" args.qtInputs or []) ++
(args.propagatedBuildInputs or []);
Expand Down

0 comments on commit 73e9155

Please sign in to comment.