From c8c747413345fc81644bd97d0740398e07b869a7 Mon Sep 17 00:00:00 2001 From: Lu Wang Date: Mon, 29 Sep 2025 22:54:38 +0800 Subject: [PATCH] nheko: fix build on darwin --- pkgs/by-name/nh/nheko/fix-darwin-build.patch | 22 ++++++++++ pkgs/by-name/nh/nheko/package.nix | 43 ++++++++++---------- 2 files changed, 44 insertions(+), 21 deletions(-) create mode 100644 pkgs/by-name/nh/nheko/fix-darwin-build.patch diff --git a/pkgs/by-name/nh/nheko/fix-darwin-build.patch b/pkgs/by-name/nh/nheko/fix-darwin-build.patch new file mode 100644 index 000000000000..6fb5c4138807 --- /dev/null +++ b/pkgs/by-name/nh/nheko/fix-darwin-build.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4ff134c53877d5aa2e00e3c344eb5c6783cccb2f..164553d34152639c6a2c5319c2a03d7a25c33ba3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -974,16 +974,11 @@ endif() + + # potential workaround for macdeployqt issues + if(APPLE) ++ set(CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/Applications") + install(TARGETS nheko + BUNDLE DESTINATION . + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) +- qt_generate_deploy_qml_app_script( +- TARGET nheko +- OUTPUT_SCRIPT deploy_script +- NO_UNSUPPORTED_PLATFORM_ERROR +- ) +- install(SCRIPT ${deploy_script}) + endif() + + if(UNIX AND NOT APPLE) diff --git a/pkgs/by-name/nh/nheko/package.nix b/pkgs/by-name/nh/nheko/package.nix index d54028a3df54..105644a2b429 100644 --- a/pkgs/by-name/nh/nheko/package.nix +++ b/pkgs/by-name/nh/nheko/package.nix @@ -5,7 +5,6 @@ cmake, asciidoc, pkg-config, - boost, cmark, coeurl, curl, @@ -23,16 +22,17 @@ libnice, qt6Packages, fetchpatch, + withVoipSupport ? stdenv.hostPlatform.isLinux, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "nheko"; version = "0.12.1"; src = fetchFromGitHub { owner = "Nheko-Reborn"; repo = "nheko"; - rev = "v${version}"; + rev = "v${finalAttrs.version}"; hash = "sha256-WlWxe4utRSc9Tt2FsnhBwxzQsoDML2hvm3g5zRnDEiU="; }; @@ -42,6 +42,7 @@ stdenv.mkDerivation rec { url = "https://github.com/Nheko-Reborn/nheko/commit/2769642d3c7bd3c0d830b2f18ef6b3bf6a710bf4.patch"; hash = "sha256-y8aiS6h5CSJYBdsAH4jYhAyrFug7aH2H8L6rBfULnQQ="; }) + ./fix-darwin-build.patch ]; nativeBuildInputs = [ @@ -53,7 +54,6 @@ stdenv.mkDerivation rec { ]; buildInputs = [ - boost cmark coeurl curl @@ -65,35 +65,39 @@ stdenv.mkDerivation rec { nlohmann_json olm qt6Packages.qtbase + qt6Packages.qtdeclarative qt6Packages.qtimageformats qt6Packages.qtkeychain qt6Packages.qtmultimedia + qt6Packages.qtsvg qt6Packages.qttools - qt6Packages.qtwayland qt6Packages.qt-jdenticon re2 spdlog ] - ++ (with gst_all_1; [ - gstreamer - gst-plugins-base - (gst-plugins-good.override { qt6Support = true; }) - gst-plugins-bad + ++ lib.optionals stdenv.hostPlatform.isLinux [ + qt6Packages.qtwayland + ] + ++ lib.optionals withVoipSupport [ + gst_all_1.gstreamer + gst_all_1.gst-plugins-base + (gst_all_1.gst-plugins-good.override { qt6Support = true; }) + gst_all_1.gst-plugins-bad libnice - ]); + ]; cmakeFlags = [ - "-DCOMPILE_QML=ON" # see https://github.com/Nheko-Reborn/nheko/issues/389 + (lib.cmakeBool "VOIP" withVoipSupport) ]; preFixup = '' - # add gstreamer plugins path to the wrapper # unset QT_STYLE_OVERRIDE to avoid showing a blank window when started # https://github.com/NixOS/nixpkgs/issues/333009 - qtWrapperArgs+=( - --prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0" - --unset QT_STYLE_OVERRIDE - ) + qtWrapperArgs+=(--unset QT_STYLE_OVERRIDE) + '' + + lib.optionalString withVoipSupport '' + # add gstreamer plugins path to the wrapper + qtWrapperArgs+=(--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : "$GST_PLUGIN_SYSTEM_PATH_1_0") ''; meta = with lib; { @@ -107,8 +111,5 @@ stdenv.mkDerivation rec { rnhmjoj ]; platforms = platforms.all; - # Should be fixable if a higher clang version is used, see: - # https://github.com/NixOS/nixpkgs/pull/85922#issuecomment-619287177 - broken = stdenv.hostPlatform.isDarwin; }; -} +})