From cdd1c216ff377e724d390aaed73cc7b5fc2273bb Mon Sep 17 00:00:00 2001 From: Matthew Glazar Date: Sat, 1 Feb 2020 17:53:55 -0800 Subject: chatterino2: fix install on macOS On Darwin/macOS, chatterino2's install phase copies no files into the output. `make install` does not copy chatterino2.app. Copy the .app manually, fixing the installation. With this patch, chatterino2 almost works on macOS. Issue #42893 applies, so to make chatterino2 work, you must install qtbase in your environment. For example: $ nix-env -iA nixpkgs.qt5.qtbase $ open ~/.nix-profile/Applications/chatterino.app --- .../networking/instant-messengers/chatterino2/default.nix | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkgs/applications/networking/instant-messengers/chatterino2/default.nix b/pkgs/applications/networking/instant-messengers/chatterino2/default.nix index 787d66826ef1..f3051eabe2bc 100644 --- a/pkgs/applications/networking/instant-messengers/chatterino2/default.nix +++ b/pkgs/applications/networking/instant-messengers/chatterino2/default.nix @@ -1,4 +1,4 @@ -{ mkDerivation, lib, pkgconfig, fetchFromGitHub, qtbase, qtsvg, qtmultimedia, qmake, boost, openssl }: +{ mkDerivation, stdenv, lib, pkgconfig, fetchFromGitHub, qtbase, qtsvg, qtmultimedia, qmake, boost, openssl }: mkDerivation rec { pname = "chatterino2"; @@ -12,6 +12,10 @@ mkDerivation rec { }; nativeBuildInputs = [ qmake pkgconfig ]; buildInputs = [ qtbase qtsvg qtmultimedia boost openssl ]; + postInstall = lib.optionalString stdenv.isDarwin '' + mkdir -p "$out/Applications" + mv bin/chatterino.app "$out/Applications/" + ''; meta = with lib; { description = "A chat client for Twitch chat"; longDescription = '' -- cgit 1.4.1 From 1221a6b096aed2276d25963434cacb805f133cca Mon Sep 17 00:00:00 2001 From: Matthew Glazar Date: Sat, 1 Feb 2020 19:55:55 -0800 Subject: chatterino2: fix: Could not find the Qt platform plugin "cocoa" in "" wrapQtAppsHook ignores Mach-O binaries [1]. Additionally, wrapQtAppsHook doesn't look inside $out/Applications [2], which is where chatterino2 is installed. This means chatterino2 for Darwin/macOS is not wrapped properly, causing the following error when launched: > qt.qpa.plugin: Could not find the Qt platform plugin "cocoa" in "" > > This application failed to start because no Qt platform plugin could > be initialized. Reinstalling the application may fix this problem. On macOS, explicitly wrap chatterino2's executable. [1] pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh line 85 [2] pkgs/development/libraries/qt-5/hooks/wrap-qt-apps-hook.sh line 76 --- .../networking/instant-messengers/chatterino2/default.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pkgs/applications/networking/instant-messengers/chatterino2/default.nix b/pkgs/applications/networking/instant-messengers/chatterino2/default.nix index f3051eabe2bc..553b466b12f9 100644 --- a/pkgs/applications/networking/instant-messengers/chatterino2/default.nix +++ b/pkgs/applications/networking/instant-messengers/chatterino2/default.nix @@ -1,4 +1,4 @@ -{ mkDerivation, stdenv, lib, pkgconfig, fetchFromGitHub, qtbase, qtsvg, qtmultimedia, qmake, boost, openssl }: +{ mkDerivation, stdenv, lib, pkgconfig, fetchFromGitHub, qtbase, qtsvg, qtmultimedia, qmake, boost, openssl, wrapQtAppsHook }: mkDerivation rec { pname = "chatterino2"; @@ -10,12 +10,15 @@ mkDerivation rec { sha256 = "0i2385hamhd9i7jdy906cfrd81cybw524j92l87c8pzrkxphignk"; fetchSubmodules = true; }; - nativeBuildInputs = [ qmake pkgconfig ]; + nativeBuildInputs = [ qmake pkgconfig wrapQtAppsHook ]; buildInputs = [ qtbase qtsvg qtmultimedia boost openssl ]; postInstall = lib.optionalString stdenv.isDarwin '' mkdir -p "$out/Applications" mv bin/chatterino.app "$out/Applications/" ''; + postFixup = lib.optionalString stdenv.isDarwin '' + wrapQtApp "$out/Applications/chatterino.app/Contents/MacOS/chatterino" + ''; meta = with lib; { description = "A chat client for Twitch chat"; longDescription = '' -- cgit 1.4.1