depot/nix/pkgs/javaws-env.nix

62 lines
1.5 KiB
Nix
Raw Permalink Normal View History

# SPDX-FileCopyrightText: 2020 Luke Granger-Brown <depot@lukegb.com>
#
# SPDX-License-Identifier: Apache-2.0
{ pkgs, ... }:
let
jdk = pkgs.jdk8;
cookedJDK = pkgs.stdenvNoCC.mkDerivation {
inherit (jdk) version;
pname = jdk.pname + "-cooked";
outputs = [ "out" "jre" ];
src = jdk;
unpackPhase = "";
installPhase = ''
cp -R $src $out
chmod -R u+rw $out
cp -R ${jdk.jre} $jre
chmod -R u+rw $jre
for symlink in $(find $out -lname '*jre*'); do
original_target="$(readlink -f "$symlink")"
new_target="$(echo "$original_target" | sed "s,${jdk.jre},$jre,g")"
rm "$symlink"
ln -s "$new_target" "$symlink"
done
# Reenable RC4 and SSLv3 :(
sed -Ei \
-e 's/jdk.tls.disabledAlgorithms=/disabled.\0/' \
-e 's/jdk.jar.disabledAlgorithms=/disabled.\0/' \
-e 's/jdk.certpath.disabledAlgorithms=/disabled.\0/' \
$jre/lib/openjdk/jre/lib/security/java.security
cat <<EOF >>"$jre/lib/openjdk/jre/lib/security/java.security"
jdk.tls.disabledAlgorithms=
jdk.jar.disabledAlgorithms=
jdk.certpath.disabledAlgorithms=
EOF
'';
meta = jdk.meta;
passthru = jdk.passthru // {
home = "${cookedJDK}/lib/openjdk";
};
};
icedtea = pkgs.adoptopenjdk-icedtea-web.override {
jdk = cookedJDK;
};
in
pkgs.buildFHSUserEnv {
name = "javaws-env";
targetPkgs = pkgs: (with pkgs;
[
icedtea
]);
runScript = "javaws";
passthru.jdk = cookedJDK;
passthru.icedtea = icedtea;
}