Hi everyone,
I'd like to know how can I install the oraclejdk8
which seems to be listed here
https://github.com/NixOS/nixpkgs/tree/master/pkgs/development/compilers/oraclejdk
I do need oraclejdk for my workload and so far I've been trying without any success.
Please do help me out :)
Please see this section on installing unfree software and after setting the relevant settings, try installing it again. It should emit instructions that you can follow.
https://nixos.org/nixpkgs/manual/#chap-packageconfig
Particularly, system-wide:
# /etc/nixos/configuration.nix
{
nixpkgs.config = {
allowUnfree = true;
};
}
Or user-wide:
# ~/.config/nixpkgs/config.nix
{
allowUnfree = true;
}
The main issue with the OracleJDK is that you need to accept their licenses before the actual download which is implemented with requireFile
in nixpkgs
.
Most packages render instructions how to install the unfree tarball into the Nix store, obviously the oraclejdk
doesn't (as I unfortunately have to use it as well for work, I'll file a patch tonight to fix this).
I did the following:
jdk-8u181-linux-x64.tar.gz
in my case) from https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html (IIRC you don't need an Oracle account for this)pkgs.oraclejdk
in your configuration.nix
or nix-env -iA
@Ma27 Under which circumstances does the oraclejdk derivation fail to render the requireFile instructions?
ah my bad, I forgot that requireFile
delivers an error message for this if now message
is passed to requireFile
, sorry! :sweat_smile:
No problem, was just confused as I couldn't reproduce it. :D
generally, overriding requireFile
helps
something like
nixpkgs.overlays = [
(self: super:
let
oracleurls = {
"jdk-8u171-linux-x64.tar.gz" = http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz;
"jdk-8u171-linux-i586.tar.gz" = http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-i586.tar.gz;
"jdk-8u171-linux-arm32-vfp-hflt.tar.gz" = http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-arm32-vfp-hflt.tar.gz;
"jdk-8u171-linux-arm64-vfp-hflt.tar.gz" = http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-arm64-vfp-hflt.tar.gz;
"jdk-8u181-linux-x64.tar.gz" = http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.tar.gz;
"jdk-8u181-linux-i586.tar.gz" = http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-i586.tar.gz;
"jdk-8u181-linux-arm32-vfp-hflt.tar.gz" = http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-arm32-vfp-hflt.tar.gz;
"jdk-8u181-linux-arm64-vfp-hflt.tar.gz" = http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-arm64-vfp-hflt.tar.gz;
};
requireFileOracle = {name, sha256, url}: self.stdenv.mkDerivation {
inherit name;
outputHashMode = "flat";
outputHashAlgo = "sha256";
outputHash = sha256;
buildCommand = "${self.curl}/bin/curl -L --insecure -o $out -H 'Cookie: oraclelicense=accept-securebackup-cookie' ${oracleurls.${name}}";
};
in {
oraclejdk8 = super.oraclejdk8.override { requireFile = requireFileOracle; };
})
];
@abhi18av I am closing this since everything appears to be working correctly. Please feel free to leave another comment if you still require assistance.
nixpkgs.config = {
allowUnfree = true;
oraclejdk.accept_license = true;
}
Most helpful comment