From 348da227c569d07ca572e6279e41a84dafe48404 Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sat, 13 Aug 2022 13:31:05 +0200 Subject: [PATCH 1/2] communi: fix Qt wrapping --- .../networking/irc/communi/default.nix | 48 +++++++++++-------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/pkgs/applications/networking/irc/communi/default.nix b/pkgs/applications/networking/irc/communi/default.nix index b9321f0797fa..71c559cbe713 100644 --- a/pkgs/applications/networking/irc/communi/default.nix +++ b/pkgs/applications/networking/irc/communi/default.nix @@ -1,4 +1,11 @@ -{ fetchFromGitHub, libcommuni, qtbase, qmake, lib, stdenv, wrapQtAppsHook }: +{ stdenv +, lib +, fetchFromGitHub +, libcommuni +, qmake +, qtbase +, wrapQtAppsHook +}: stdenv.mkDerivation rec { pname = "communi"; @@ -15,12 +22,15 @@ stdenv.mkDerivation rec { fetchSubmodules = true; }; - nativeBuildInputs = [ qmake ] - ++ lib.optional stdenv.isDarwin wrapQtAppsHook; + nativeBuildInputs = [ + qmake + wrapQtAppsHook + ]; - buildInputs = [ libcommuni qtbase ]; - - dontWrapQtApps = true; + buildInputs = [ + libcommuni + qtbase + ]; preConfigure = '' export QMAKEFEATURES=${libcommuni}/features @@ -32,20 +42,19 @@ stdenv.mkDerivation rec { "COMMUNI_INSTALL_ICONS=${placeholder "out"}/share/icons/hicolor" "COMMUNI_INSTALL_DESKTOP=${placeholder "out"}/share/applications" "COMMUNI_INSTALL_THEMES=${placeholder "out"}/share/communi/themes" - (if stdenv.isDarwin - then [ "COMMUNI_INSTALL_BINS=${placeholder "out"}/Applications" ] - else [ "COMMUNI_INSTALL_BINS=${placeholder "out"}/bin" ]) + "COMMUNI_INSTALL_BINS=${placeholder "out"}/${if stdenv.isDarwin then "Applications" else "bin"}" ]; - postInstall = if stdenv.isDarwin then '' - # Nix qmake does not add the bundle rpath by default. - install_name_tool \ - -add_rpath @executable_path/../Frameworks \ - $out/Applications/Communi.app/Contents/MacOS/Communi - '' else '' - substituteInPlace "$out/share/applications/communi.desktop" \ - --replace "/usr/bin" "$out/bin" - ''; + postInstall = + if stdenv.isDarwin then '' + # Nix qmake does not add the bundle rpath by default. + install_name_tool \ + -add_rpath @executable_path/../Frameworks \ + $out/Applications/Communi.app/Contents/MacOS/Communi + '' else '' + substituteInPlace "$out/share/applications/communi.desktop" \ + --replace "/usr/bin" "$out/bin" + ''; preFixup = '' rm -rf lib @@ -56,6 +65,7 @@ stdenv.mkDerivation rec { homepage = "https://github.com/communi/communi-desktop"; license = licenses.bsd3; maintainers = with maintainers; [ hrdinka ]; - platforms = platforms.linux; + platforms = platforms.all; + broken = stdenv.isDarwin; }; } From 86ead2fed9cbd61ef7b7f4f2af4702a9456536cf Mon Sep 17 00:00:00 2001 From: OPNA2608 Date: Sun, 14 Aug 2022 00:47:24 +0200 Subject: [PATCH 2/2] communi: fix on Darwin Manual `wrapQtApp` call was previously removed in e0532475bca400362a2a488e31c86c6628a8e55a but is required here because we work around `wrapQtAppsHook` trying to wrap dylibs in app bundles. --- pkgs/applications/networking/irc/communi/default.nix | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/networking/irc/communi/default.nix b/pkgs/applications/networking/irc/communi/default.nix index 71c559cbe713..cbd099c33bc7 100644 --- a/pkgs/applications/networking/irc/communi/default.nix +++ b/pkgs/applications/networking/irc/communi/default.nix @@ -32,6 +32,11 @@ stdenv.mkDerivation rec { qtbase ]; + # libCommuni.dylib is installed in $out/Applications/Communi.app/Contents/Frameworks/ on Darwin + # Wrapper hook thinks it's a binary because it's in $out/Applications, wraps it with a shell script + # So we manually call the wrapper script on just the binary + dontWrapQtApps = stdenv.isDarwin; + preConfigure = '' export QMAKEFEATURES=${libcommuni}/features ''; @@ -51,6 +56,9 @@ stdenv.mkDerivation rec { install_name_tool \ -add_rpath @executable_path/../Frameworks \ $out/Applications/Communi.app/Contents/MacOS/Communi + + # Do not remove until wrapQtAppsHook doesn't wrap dylibs in app bundles anymore + wrapQtApp $out/Applications/Communi.app/Contents/MacOS/Communi '' else '' substituteInPlace "$out/share/applications/communi.desktop" \ --replace "/usr/bin" "$out/bin" @@ -66,6 +74,5 @@ stdenv.mkDerivation rec { license = licenses.bsd3; maintainers = with maintainers; [ hrdinka ]; platforms = platforms.all; - broken = stdenv.isDarwin; }; }