grimm-nixos-laptop/common/tooling/java.nix
2024-05-30 22:12:15 +02:00

42 lines
811 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
] ++ optionals graphical [ pkgs.jetbrains.idea-community ];
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 ]);
};
}