grimm-nixos-laptop/common/tooling/java.nix
2024-12-23 17:45:20 +01:00

44 lines
897 B
Nix

{
pkgs,
config,
lib,
...
}:
let
lang_support_id = "java";
inherit (config.grimmShared) enable tooling graphical;
inherit (lib)
optionals
mkIf
types
mkOption
elem
;
in
{
config = mkIf (enable && tooling.enable && (elem lang_support_id tooling.supportedLangs)) {
environment.systemPackages = [
pkgs.jdk17
pkgs.visualvm
pkgs.gradle_7
]; # ++ optionals graphical [ pkgs.jetbrains.idea-community ];
environment.sessionVariables.JAVA_HOME = pkgs.jdk17.home;
grimmShared.tooling.lang_servers = [
{
lsp = {
package = pkgs.jdt-language-server;
};
fmt = {
package = pkgs.google-java-format;
includes = [ "*.java" ];
};
}
];
};
options.grimmShared.tooling.supportedLangs = mkOption {
type = types.listOf (types.enum [ lang_support_id ]);
};
}