quba: Add support for darwin

+50 -19
+50 -19
pkgs/by-name/qu/quba/package.nix
··· 1 1 { 2 2 lib, 3 + stdenvNoCC, 3 4 appimageTools, 4 5 fetchurl, 6 + _7zz, 5 7 }: 6 8 7 9 let 10 + pname = "quba"; 8 11 version = "1.4.2"; 9 - pname = "quba"; 12 + 13 + meta = { 14 + description = "Viewer for electronic invoices"; 15 + homepage = "https://github.com/ZUGFeRD/quba-viewer"; 16 + downloadPage = "https://github.com/ZUGFeRD/quba-viewer/releases"; 17 + license = lib.licenses.asl20; 18 + sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 19 + maintainers = with lib.maintainers; [ onny ]; 20 + platforms = [ "x86_64-linux" ] ++ lib.platforms.darwin; 21 + }; 10 22 11 23 src = fetchurl { 12 24 url = "https://github.com/ZUGFeRD/quba-viewer/releases/download/v${version}/Quba-${version}.AppImage"; ··· 14 26 }; 15 27 16 28 appimageContents = appimageTools.extractType1 { inherit pname version src; }; 17 - in 18 - appimageTools.wrapType1 { 19 - inherit pname version src; 29 + 30 + linux = appimageTools.wrapType1 { 31 + inherit 32 + pname 33 + version 34 + src 35 + meta 36 + ; 37 + 38 + extraInstallCommands = '' 39 + install -m 444 -D ${appimageContents}/quba.desktop -t $out/share/applications 40 + substituteInPlace $out/share/applications/quba.desktop \ 41 + --replace-fail 'Exec=AppRun' 'Exec=quba' 42 + cp -r ${appimageContents}/usr/share/icons $out/share 43 + ''; 44 + }; 45 + 46 + darwin = stdenvNoCC.mkDerivation { 47 + inherit pname version meta; 48 + 49 + src = fetchurl { 50 + url = "https://github.com/ZUGFeRD/quba-viewer/releases/download/v${version}/Quba-${version}-universal.dmg"; 51 + hash = "sha256-q7va2D9AT0BoPhfkub/RFQxGyF12uFaCDpSYIxslqMc="; 52 + }; 20 53 21 - extraInstallCommands = '' 22 - install -m 444 -D ${appimageContents}/${pname}.desktop -t $out/share/applications 23 - substituteInPlace $out/share/applications/${pname}.desktop \ 24 - --replace-fail 'Exec=AppRun' 'Exec=${pname}' 25 - cp -r ${appimageContents}/usr/share/icons $out/share 26 - ''; 54 + unpackCmd = "7zz x -bd -osource -xr'!*/Applications' -xr'!*com.apple.provenance' $curSrc"; 27 55 28 - meta = { 29 - description = "Viewer for electronic invoices"; 30 - homepage = "https://github.com/ZUGFeRD/quba-viewer"; 31 - downloadPage = "https://github.com/ZUGFeRD/quba-viewer/releases"; 32 - license = lib.licenses.asl20; 33 - sourceProvenance = with lib.sourceTypes; [ binaryNativeCode ]; 34 - maintainers = with lib.maintainers; [ onny ]; 35 - platforms = [ "x86_64-linux" ]; 56 + nativeBuildInputs = [ _7zz ]; 57 + 58 + installPhase = '' 59 + runHook preInstall 60 + 61 + mkdir -p $out/Applications 62 + mv Quba.app $out/Applications 63 + 64 + runHook postInstall 65 + ''; 36 66 }; 37 - } 67 + in 68 + if stdenvNoCC.hostPlatform.isLinux then linux else darwin