mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 11:36:05 +01:00
Some files don't need nesting and can be root level again to reduce conflicts with other PRs. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
40 lines
942 B
Nix
40 lines
942 B
Nix
# This module provides JAVA_HOME, with a different way to install java locally.
|
|
# This module is modified from the NixOS module `programs.java`
|
|
{
|
|
config,
|
|
lib,
|
|
pkgs,
|
|
...
|
|
}:
|
|
let
|
|
|
|
cfg = config.programs.java;
|
|
|
|
in
|
|
{
|
|
meta.maintainers = with lib.maintainers; [ ShamrockLee ];
|
|
|
|
options = {
|
|
programs.java = {
|
|
enable = lib.mkEnableOption "" // {
|
|
description = ''
|
|
Install the Java development kit and set the
|
|
{env}`JAVA_HOME` variable.
|
|
'';
|
|
};
|
|
|
|
package = lib.mkPackageOption pkgs "java" {
|
|
default = "jdk";
|
|
example = "pkgs.jre";
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
home.packages = [ cfg.package ];
|
|
|
|
# some instances of `jdk-linux-base.nix` pass through `result` without turning it onto a path-string.
|
|
# while I suspect this is incorrect, the documentation is unclear.
|
|
home.sessionVariables.JAVA_HOME = "${cfg.package.home}";
|
|
};
|
|
}
|