about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/editors/bluej/default.nix
blob: 7980cf386e2b21e934a9ad18b804ca075c8b0e00 (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
{ lib, stdenv, fetchurl, openjdk, glib, wrapGAppsHook, zstd }:

stdenv.mkDerivation rec {
  pname = "bluej";
  version = "5.2.0";

  src = fetchurl {
    # We use the deb here. First instinct might be to go for the "generic" JAR
    # download, but that is actually a graphical installer that is much harder
    # to unpack than the deb.
    url = "https://www.bluej.org/download/files/BlueJ-linux-${builtins.replaceStrings ["."] [""] version}.deb";
    sha256 = "sha256-sOT86opMa9ytxJlfURIsD06HiP+j+oz3lQ0DqmLV1wE=";
  };

  nativeBuildInputs = [ zstd wrapGAppsHook ];
  buildInputs = [ glib ];

  sourceRoot = ".";

  preUnpack = ''
    unpackCmdHooks+=(_tryDebData)
    _tryDebData() {
      if ! [[ "$1" =~ \.deb$ ]]; then return 1; fi
      ar xf $src
      if ! [[ -e data.tar.zst ]]; then return 1; fi
      unpackFile data.tar.zst
    }
  '';

  dontWrapGApps = true;

  installPhase = ''
    runHook preInstall

    mkdir -p $out
    cp -r usr/* $out

    makeWrapper ${openjdk}/bin/java $out/bin/bluej \
      "''${gappsWrapperArgs[@]}" \
      --add-flags "-Dawt.useSystemAAFontSettings=on -Xmx512M \
                   --add-opens javafx.graphics/com.sun.glass.ui=ALL-UNNAMED \
                   -cp $out/share/bluej/boot.jar bluej.Boot"

    runHook postInstall
  '';

  meta = with lib; {
    description = "A simple integrated development environment for Java";
    homepage = "https://www.bluej.org/";
    sourceProvenance = with sourceTypes; [ binaryBytecode ];
    license = licenses.gpl2ClasspathPlus;
    maintainers = with maintainers; [ chvp ];
    platforms = platforms.linux;
  };
}