From 31b8f592144ad9c3459143866bc4baab75897e4d Mon Sep 17 00:00:00 2001 From: Tigor Hutasuhut Date: Fri, 15 Nov 2024 10:49:32 +0700 Subject: [PATCH] java: added lombok support --- home/programs/default.nix | 1 + home/programs/java.nix | 28 ++++++++++++++++++++++++++++ options/programs.nix | 1 + profiles/castle.nix | 1 + 4 files changed, 31 insertions(+) create mode 100644 home/programs/java.nix diff --git a/home/programs/default.nix b/home/programs/default.nix index cbeeb76..ad7edab 100644 --- a/home/programs/default.nix +++ b/home/programs/default.nix @@ -12,6 +12,7 @@ ./git.nix ./github.nix ./go.nix + ./java.nix ./jellyfin.nix ./jetbrains-idea.nix ./kitty.nix diff --git a/home/programs/java.nix b/home/programs/java.nix new file mode 100644 index 0000000..3df0344 --- /dev/null +++ b/home/programs/java.nix @@ -0,0 +1,28 @@ +{ + pkgs, + lib, + config, + ... +}: +let + cfg = config.profile.home.programs.java; + inherit (lib) mkIf; + version = "1.18.36"; + lombokJar = pkgs.fetchurl { + url = "https://projectlombok.org/downloads/lombok-${version}.jar"; + sha256 = "sha256-c7awW2otNltwC6sI0w+U3p0zZJC8Cszlthgf70jL8Y4="; + }; +in +{ + config = mkIf cfg.enable { + # This registers lombok jar to the Java classpath + # https://github.com/NixOS/nixpkgs/blob/689fed12a013f56d4c4d3f612489634267d86529/pkgs/development/libraries/java/lombok/default.nix#L21 + home.packages = [ pkgs.lombok ]; + + # This one adds the lombok jar to the session variables so programs + # can find it if they cannot find it in the classpath. + home.sessionVariables = { + LOMBOK_JAR = lombokJar; + }; + }; +} diff --git a/options/programs.nix b/options/programs.nix index e4bc77f..25cf63b 100644 --- a/options/programs.nix +++ b/options/programs.nix @@ -74,6 +74,7 @@ home.programs = { zathura.enable = lib.mkEnableOption "zathura"; floorp.enable = lib.mkEnableOption "floorp"; + java.enable = lib.mkEnableOption "java"; zellij = { enable = lib.mkEnableOption "zellij"; diff --git a/profiles/castle.nix b/profiles/castle.nix index 40727e1..aa51fd1 100644 --- a/profiles/castle.nix +++ b/profiles/castle.nix @@ -113,6 +113,7 @@ in elisa.enable = true; obsidian.enable = true; jetbrains.idea.enable = true; + java.enable = true; }; programs.mongodb-compass.enable = true;