nixpkgs-suyu/pkgs/development/compilers/adoptopenjdk-bin/jdk-darwin-base.nix
Frederik Rietdijk 7cb0bc30e6
Merge pull request #70176 from taku0/adoptopenjdk-bin-11.0.4
adoptopenjdk-bin: 11.0.3 -> 11.0.5, 8.0.222 -> 8.0.232 [Security fixes]
2019-11-24 10:19:00 +01:00

53 lines
1.3 KiB
Nix

sourcePerArch:
{ swingSupport ? true # not used for now
, stdenv
, fetchurl
}:
let cpuName = stdenv.hostPlatform.parsed.cpu.name;
result = stdenv.mkDerivation {
name = if sourcePerArch.packageType == "jdk"
then "adoptopenjdk-${sourcePerArch.vmType}-bin-${sourcePerArch.${cpuName}.version}"
else "adoptopenjdk-${sourcePerArch.packageType}-${sourcePerArch.vmType}-bin-${sourcePerArch.${cpuName}.version}";
src = fetchurl {
inherit (sourcePerArch.${cpuName}) 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*
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;
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