about summary refs log tree commit diff
path: root/pkgs/applications/misc/signumone-ks/default.nix
blob: f183fbed3d2e4cdf8df7704856871221e3593e39 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{ lib, stdenv, fetchurl, dpkg, autoPatchelfHook, makeWrapper,
  atk, ffmpeg, gdk-pixbuf, gtk3, libXtst }:

stdenv.mkDerivation rec {
  pname = "signumone-ks";
  version = "3.1.3";

  src = fetchurl {
    url = "https://cdn-dist.signum.one/${version}/${pname}-${version}.deb";
    sha256 = "00wlya3kb6qac2crflm86km9r48r29bvngjq1wgzj9w2xv0q32b9";
  };

  # Necessary to avoid using multiple ffmpeg and gtk libs
  autoPatchelfIgnoreMissingDeps = true;

  nativeBuildInputs = [
    autoPatchelfHook
    dpkg
    makeWrapper
  ];

  buildInputs = [
    atk gdk-pixbuf ffmpeg
    gtk3 libXtst
  ];

  libPath = lib.makeLibraryPath buildInputs;

  unpackPhase = ''
    dpkg-deb -x ${src} ./
  '';

  installPhase = ''
    DESKTOP_PATH=$out/share/applications/signumone-ks.desktop

    mkdir -p $out/bin $out/share/applications
    mv opt/SignumOne-KS/SignumOne-KS.desktop $DESKTOP_PATH
    mv opt $out

    substituteInPlace $DESKTOP_PATH --replace 'Exec=/opt/SignumOne-KS' Exec=$out/bin
    substituteInPlace $DESKTOP_PATH --replace 'Icon=' Icon=$out

    makeWrapper $out/opt/SignumOne-KS/SignumOne-KS \
      $out/bin/SignumOne-KS \
      --prefix LD_LIBRARY_PATH : ${libPath}
  '';

  meta = with lib; {
    description = "Digital signature tool for Costa Rican electronic invoicing";
    homepage = "https://signum.one/download.html";
    sourceProvenance = with sourceTypes; [
      binaryBytecode
      binaryNativeCode
    ];
    license = licenses.unfree;
    maintainers = with maintainers; [ wolfangaukang ];
    platforms = [ "x86_64-linux" ];
  };
}