summaryrefslogtreecommitdiff
path: root/pkgs/athena-bccr/firmador.nix
blob: eef413bd7b06f3031709031b0104390f3f64dc2a (plain)
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
{ fetchgit
, lib
, makeWrapper
, maven
, openjdk
, wrapGAppsHook

, libasep11 ? null
}:
let
  jdk = openjdk.override {
    enableJavaFX = true;
  };

  version = "1.9.8";
in
maven.buildMavenPackage {
  pname = "firmador";
  inherit version;

  src = fetchgit {
    url = "https://codeberg.org/firmador/firmador";
    rev = version;
    hash = "sha256-xdiVPjihRADPK4nG+WQHWsDzVYLCeN6ouQ6SDtjf1qQ=";
  };

  patches = [
    ./0001-Remove-CheckUpdatePlugin-from-default-list.patch
  ];

  mvnHash = "sha256-h1zoStTgaE7toWWKq0Y0ahOORyltChwjmaMYjLgs1VE=";

  nativeBuildInputs = [
    makeWrapper
    wrapGAppsHook
  ];

  postPatch = lib.optionalString (libasep11 != null) ''
    sed -i 's@/usr/lib/x64-athena/libASEP11.so@${libasep11}@g' src/main/java/cr/libre/firmador/CRSigner.java
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out/bin $out/share/java
    install -Dm644 target/firmador.jar $out/share/java

    makeWrapper ${jdk}/bin/java $out/bin/firmador \
      --add-flags "-jar $out/share/java/firmador.jar"

    runHook postInstall
  '';

  meta = {
    homepage = "https://firmador.libre.cr";
    license = lib.licenses.gpl3Plus;
  };
}