2018-12-17 22:08:56 +00:00
|
|
|
sourcePerArch:
|
2018-10-20 07:18:56 +00:00
|
|
|
|
|
|
|
{ swingSupport ? true # not used for now
|
2021-01-22 11:25:31 +00:00
|
|
|
, lib, stdenv
|
2018-10-20 07:18:56 +00:00
|
|
|
, fetchurl
|
|
|
|
}:
|
|
|
|
|
2019-01-23 11:52:02 +00:00
|
|
|
let cpuName = stdenv.hostPlatform.parsed.cpu.name;
|
2019-08-13 21:52:01 +00:00
|
|
|
result = stdenv.mkDerivation {
|
2018-12-17 22:08:56 +00:00
|
|
|
name = if sourcePerArch.packageType == "jdk"
|
2019-01-23 11:52:02 +00:00
|
|
|
then "adoptopenjdk-${sourcePerArch.vmType}-bin-${sourcePerArch.${cpuName}.version}"
|
|
|
|
else "adoptopenjdk-${sourcePerArch.packageType}-${sourcePerArch.vmType}-bin-${sourcePerArch.${cpuName}.version}";
|
2018-10-20 07:18:56 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2019-01-23 11:52:02 +00:00
|
|
|
inherit (sourcePerArch.${cpuName}) url sha256;
|
2018-10-20 07:18:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
# 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*
|
|
|
|
|
|
|
|
ln -s $out/Contents/Home/* $out/
|
|
|
|
|
|
|
|
mkdir -p $out/nix-support
|
|
|
|
|
|
|
|
# Set JAVA_HOME automatically.
|
|
|
|
cat <<EOF >> $out/nix-support/setup-hook
|
2019-11-01 19:30:09 +00:00
|
|
|
if [ -z "\''${JAVA_HOME-}" ]; then export JAVA_HOME=$out; fi
|
2018-10-20 07:18:56 +00:00
|
|
|
EOF
|
|
|
|
'';
|
|
|
|
|
|
|
|
# FIXME: use multiple outputs or return actual JRE package
|
|
|
|
passthru.jre = result;
|
|
|
|
|
|
|
|
passthru.home = result;
|
|
|
|
|
2021-01-22 11:25:31 +00:00
|
|
|
meta = with lib; {
|
2018-10-20 07:18:56 +00:00
|
|
|
license = licenses.gpl2Classpath;
|
|
|
|
description = "AdoptOpenJDK, prebuilt OpenJDK binary";
|
|
|
|
platforms = [ "x86_64-darwin" ]; # some inherit jre.meta.platforms
|
2021-01-22 11:25:31 +00:00
|
|
|
maintainers = with lib.maintainers; [ taku0 ];
|
2018-10-20 07:18:56 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}; in result
|