about summary refs log tree commit diff
path: root/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix
blob: c2c13649f885c0efcb3694e21951f75850630e3d (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
{ name
, url
, sha256
}:

{ swingSupport ? true # not used for now
, stdenv
, fetchurl
}:

let result = stdenv.mkDerivation rec {
  inherit name;

  src = fetchurl {
    inherit url sha256;
  };

  # See: https://github.com/NixOS/patchelf/issues/10
  dontStrip = 1;

  installPhase = ''
    cd ..

    mv $sourceRoot $out

    rm -rf $out/Home/demo

    # Remove some broken manpages.
    rm -rf $out/Home/man/ja*

    # for backward compatibility
    ln -s $out/Contents/Home $out/jre

    ln -s $out/Contents/Home/* $out/

    mkdir -p $out/nix-support

    # Set JAVA_HOME automatically.
    cat <<EOF >> $out/nix-support/setup-hook
    if [ -z "\$JAVA_HOME" ]; then export JAVA_HOME=$out; fi
    EOF
  '';

  # FIXME: use multiple outputs or return actual JRE package
  passthru.jre = result;

  passthru.home = result;

  # for backward compatibility
  passthru.architecture = "";

  meta = with stdenv.lib; {
    license = licenses.gpl2Classpath;
    description = "AdoptOpenJDK, prebuilt OpenJDK binary";
    platforms = [ "x86_64-darwin" ]; # some inherit jre.meta.platforms
    maintainers = with stdenv.lib.maintainers; [ taku0 ];
  };

}; in result