mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
9e4a73c25e
`nix-doc-munge` can't tell what's going on with this pattern, so I just handled them all manually.
43 lines
1.1 KiB
Nix
43 lines
1.1 KiB
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, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.programs.java;
|
|
|
|
in {
|
|
meta.maintainers = with maintainers; [ ShamrockLee ];
|
|
|
|
options = {
|
|
programs.java = {
|
|
enable = mkEnableOption (lib.mdDoc "") // {
|
|
description = lib.mdDoc ''
|
|
Install the Java development kit and set the
|
|
{env}`JAVA_HOME` variable.
|
|
'';
|
|
};
|
|
|
|
package = mkOption {
|
|
type = types.package;
|
|
default = pkgs.jdk;
|
|
defaultText = "pkgs.jdk";
|
|
description = ''
|
|
Java package to install. Typical values are
|
|
<literal>pkgs.jdk</literal> or <literal>pkgs.jre</literal>.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
|
|
config = 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}";
|
|
};
|
|
}
|