nixpkgs/pkgs/applications/networking/instant-messengers/chatterino2/default.nix
Matthew Glazar 1221a6b096 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
2020-02-01 19:59:08 -08:00

36 lines
1.3 KiB
Nix

{ mkDerivation, stdenv, lib, pkgconfig, fetchFromGitHub, qtbase, qtsvg, qtmultimedia, qmake, boost, openssl, wrapQtAppsHook }:
mkDerivation rec {
pname = "chatterino2";
version = "unstable-2019-05-11";
src = fetchFromGitHub {
owner = "fourtf";
repo = pname;
rev = "8c46cbf571dc8fd77287bf3186445ff52b1d1aaf";
sha256 = "0i2385hamhd9i7jdy906cfrd81cybw524j92l87c8pzrkxphignk";
fetchSubmodules = true;
};
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 = ''
Chatterino is a chat client for Twitch chat. It aims to be an
improved/extended version of the Twitch web chat. Chatterino 2 is
the second installment of the Twitch chat client series
"Chatterino".
'';
homepage = "https://github.com/fourtf/chatterino2";
license = licenses.mit;
platforms = platforms.unix;
maintainers = with maintainers; [ rexim ];
};
}