about summary refs log tree commit diff
path: root/pkgs/tools/misc/jugglinglab/default.nix
blob: 64b91a68d9480cc45956f8092361f29d48382978 (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{ lib
, stdenv
, maven
, fetchFromGitHub
, makeWrapper
, wrapGAppsHook
, jre
}:

let
  platformName = {
    "x86_64-linux" = "linux-x86-64";
    "aarch64-linux" = "linux-aarch64";
    "x86_64-darwin" = "darwin-x86-64";
    "aarch64-darwin" = "darwin-aarch64";
  }.${stdenv.system} or null;
in
maven.buildMavenPackage rec {
  pname = "jugglinglab";
  version = "1.6.5";

  src = fetchFromGitHub {
    owner = "jkboyce";
    repo = "jugglinglab";
    rev = "v${version}";
    hash = "sha256-Y87uHFpVs4A/wErNO2ZF6Su0v4LEvaE9nIysrqFoY8w=";
  };

  patches = [
    # make sure mvnHash doesn't change when maven is updated
    ./fix-default-maven-plugin-versions.patch
  ];

  mvnHash = "sha256-1Uzo9nRw+YR/sd7CC9MTPe/lttkRX6BtmcsHaagP1Do=";

  # fix jar timestamps for reproducibility
  mvnParameters = "-Dproject.build.outputTimestamp=1980-01-01T00:00:02Z";

  nativeBuildInputs = [
    makeWrapper
    wrapGAppsHook
  ];

  dontWrapGApps = true;

  installPhase = ''
    runHook preInstall

    install -Dm644 bin/JugglingLab.jar -t $out/share/jugglinglab
    ${lib.optionalString (platformName != null) ''
      install -Dm755 bin/ortools-lib/ortools-${platformName}/* -t $out/lib/ortools-lib
    ''}

    runHook postInstall
  '';

  # gappsWrapperArgs are set in preFixup
  postFixup = ''
    makeWrapper ${jre}/bin/java $out/bin/jugglinglab \
        "''${gappsWrapperArgs[@]}" \
        --add-flags "-Xss2048k -Djava.library.path=$out/lib/ortools-lib" \
        --add-flags "-jar $out/share/jugglinglab/JugglingLab.jar"
  '';

  meta = with lib; {
    description = "A program to visualize different juggling pattens";
    homepage = "https://jugglinglab.org/";
    license = licenses.gpl2Only;
    mainProgram = "jugglinglab";
    maintainers = with maintainers; [ wnklmnn tomasajt ];
    platforms = platforms.all;
  };
}