nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenvNoCC,
4 appimageTools,
5 fetchurl,
6 _7zz,
7}:
8
9let
10 pname = "quba";
11 version = "1.4.2";
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 };
22
23 src = fetchurl {
24 url = "https://github.com/ZUGFeRD/quba-viewer/releases/download/v${version}/Quba-${version}.AppImage";
25 hash = "sha256-3goMWN5GeQaLJimUKbjozJY/zJmqc9Mvy2+6bVSt1p0=";
26 };
27
28 appimageContents = appimageTools.extractType1 { 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 };
53
54 unpackCmd = "7zz x -bd -osource -xr'!*/Applications' -xr'!*com.apple.provenance' $curSrc";
55
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 '';
66 };
67in
68if stdenvNoCC.hostPlatform.isLinux then linux else darwin