mirror of
https://github.com/nix-community/home-manager.git
synced 2025-12-25 02:10:57 +01:00
treewide: implement auto importing for modules
Reduce maintenance burden and increase efficiency by automatically importing modules following a specific convention. Co-authored-by: awwpotato <awwpotato@voidq.com> Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
fefeb0e928
commit
4fca600cb1
461 changed files with 72 additions and 474 deletions
40
modules/programs/java/default.nix
Normal file
40
modules/programs/java/default.nix
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
# 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}";
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue