communi: fix Qt wrapping

This commit is contained in:
OPNA2608 2022-08-13 13:31:05 +02:00
parent f8334115fb
commit 348da227c5

View file

@ -1,4 +1,11 @@
{ fetchFromGitHub, libcommuni, qtbase, qmake, lib, stdenv, wrapQtAppsHook }: { stdenv
, lib
, fetchFromGitHub
, libcommuni
, qmake
, qtbase
, wrapQtAppsHook
}:
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
pname = "communi"; pname = "communi";
@ -15,12 +22,15 @@ stdenv.mkDerivation rec {
fetchSubmodules = true; fetchSubmodules = true;
}; };
nativeBuildInputs = [ qmake ] nativeBuildInputs = [
++ lib.optional stdenv.isDarwin wrapQtAppsHook; qmake
wrapQtAppsHook
];
buildInputs = [ libcommuni qtbase ]; buildInputs = [
libcommuni
dontWrapQtApps = true; qtbase
];
preConfigure = '' preConfigure = ''
export QMAKEFEATURES=${libcommuni}/features export QMAKEFEATURES=${libcommuni}/features
@ -32,20 +42,19 @@ stdenv.mkDerivation rec {
"COMMUNI_INSTALL_ICONS=${placeholder "out"}/share/icons/hicolor" "COMMUNI_INSTALL_ICONS=${placeholder "out"}/share/icons/hicolor"
"COMMUNI_INSTALL_DESKTOP=${placeholder "out"}/share/applications" "COMMUNI_INSTALL_DESKTOP=${placeholder "out"}/share/applications"
"COMMUNI_INSTALL_THEMES=${placeholder "out"}/share/communi/themes" "COMMUNI_INSTALL_THEMES=${placeholder "out"}/share/communi/themes"
(if stdenv.isDarwin "COMMUNI_INSTALL_BINS=${placeholder "out"}/${if stdenv.isDarwin then "Applications" else "bin"}"
then [ "COMMUNI_INSTALL_BINS=${placeholder "out"}/Applications" ]
else [ "COMMUNI_INSTALL_BINS=${placeholder "out"}/bin" ])
]; ];
postInstall = if stdenv.isDarwin then '' postInstall =
# Nix qmake does not add the bundle rpath by default. if stdenv.isDarwin then ''
install_name_tool \ # Nix qmake does not add the bundle rpath by default.
-add_rpath @executable_path/../Frameworks \ install_name_tool \
$out/Applications/Communi.app/Contents/MacOS/Communi -add_rpath @executable_path/../Frameworks \
'' else '' $out/Applications/Communi.app/Contents/MacOS/Communi
substituteInPlace "$out/share/applications/communi.desktop" \ '' else ''
--replace "/usr/bin" "$out/bin" substituteInPlace "$out/share/applications/communi.desktop" \
''; --replace "/usr/bin" "$out/bin"
'';
preFixup = '' preFixup = ''
rm -rf lib rm -rf lib
@ -56,6 +65,7 @@ stdenv.mkDerivation rec {
homepage = "https://github.com/communi/communi-desktop"; homepage = "https://github.com/communi/communi-desktop";
license = licenses.bsd3; license = licenses.bsd3;
maintainers = with maintainers; [ hrdinka ]; maintainers = with maintainers; [ hrdinka ];
platforms = platforms.linux; platforms = platforms.all;
broken = stdenv.isDarwin;
}; };
} }