mirror of
https://github.com/nix-community/home-manager
synced 2024-11-27 05:29:46 +01:00
java: add module
This commit is contained in:
parent
a57ef9dad1
commit
a4a8307897
4 changed files with 56 additions and 0 deletions
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -95,6 +95,8 @@
|
||||||
|
|
||||||
/modules/programs/i3status-rust.nix @workflow
|
/modules/programs/i3status-rust.nix @workflow
|
||||||
|
|
||||||
|
/modules/programs/java.nix @ShamrockLee
|
||||||
|
|
||||||
/modules/programs/keychain.nix @marsam
|
/modules/programs/keychain.nix @marsam
|
||||||
|
|
||||||
/modules/programs/lazygit.nix @kalhauge
|
/modules/programs/lazygit.nix @kalhauge
|
||||||
|
|
|
@ -2157,6 +2157,13 @@ in
|
||||||
A new module is available: 'services.notify-osd'.
|
A new module is available: 'services.notify-osd'.
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
time = "2021-08-10T21:28:40+00:00";
|
||||||
|
message = ''
|
||||||
|
A new module is available: 'programs.java'.
|
||||||
|
'';
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,7 @@ let
|
||||||
./programs/i3status.nix
|
./programs/i3status.nix
|
||||||
./programs/info.nix
|
./programs/info.nix
|
||||||
./programs/irssi.nix
|
./programs/irssi.nix
|
||||||
|
./programs/java.nix
|
||||||
./programs/jq.nix
|
./programs/jq.nix
|
||||||
./programs/kakoune.nix
|
./programs/kakoune.nix
|
||||||
./programs/keychain.nix
|
./programs/keychain.nix
|
||||||
|
|
46
modules/programs/java.nix
Normal file
46
modules/programs/java.nix
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
# 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 "" // {
|
||||||
|
description = ''
|
||||||
|
Install the Java development kit and set the <envar>JAVA_HOME</envar>
|
||||||
|
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 ];
|
||||||
|
|
||||||
|
home.sessionVariables = {
|
||||||
|
JAVA_HOME = fileContents (pkgs.runCommandLocal "java-home" { } ''
|
||||||
|
source "${cfg.package}/nix-support/setup-hook"
|
||||||
|
echo "$JAVA_HOME" > $out
|
||||||
|
'');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue