mirror of
https://github.com/nix-community/home-manager
synced 2024-12-05 01:19:46 +01:00
parent
0e58ffec58
commit
382505714d
4 changed files with 56 additions and 0 deletions
2
.github/CODEOWNERS
vendored
2
.github/CODEOWNERS
vendored
|
@ -84,6 +84,8 @@
|
|||
|
||||
/modules/programs/i3status-rust.nix @workflow
|
||||
|
||||
/modules/programs/java.nix @ShamrockLee
|
||||
|
||||
/modules/programs/keychain.nix @marsam
|
||||
|
||||
/modules/programs/lazygit.nix @kalhauge
|
||||
|
|
|
@ -2047,6 +2047,13 @@ in
|
|||
configuration file.
|
||||
'';
|
||||
}
|
||||
|
||||
{
|
||||
time = "2021-10-03T20:00:52+00:00";
|
||||
message = ''
|
||||
A new module is available: 'programs.java'.
|
||||
'';
|
||||
}
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
@ -83,6 +83,7 @@ let
|
|||
(loadModule ./programs/info.nix { })
|
||||
(loadModule ./programs/irssi.nix { })
|
||||
(loadModule ./programs/lieer.nix { })
|
||||
(loadModule ./programs/java.nix { })
|
||||
(loadModule ./programs/jq.nix { })
|
||||
(loadModule ./programs/kakoune.nix { })
|
||||
(loadModule ./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