java: remove IFD

The previous variant used IFD to generate the `JAVA_HOME` variable and relied on internal hooks of the `java` package, this failed for a user cross compiling their configuration.

This PR changes that and uses the `home` attribute, as documented in the very last sentence of the https://nixos.org/manual/nixpkgs/stable/#sec-language-java chapter.

(cherry picked from commit b3565b3447)
This commit is contained in:
Norbert Melzer 2022-12-16 07:10:26 +01:00 committed by Robert Helgesson
parent d977182704
commit d965d248aa
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89

View file

@ -36,11 +36,6 @@ in {
config = mkIf cfg.enable {
home.packages = [ cfg.package ];
home.sessionVariables = {
JAVA_HOME = fileContents (pkgs.runCommandLocal "java-home" { } ''
source "${cfg.package}/nix-support/setup-hook"
echo "$JAVA_HOME" > $out
'');
};
home.sessionVariables.JAVA_HOME = cfg.package.home;
};
}