From 8b9642f8a4533b0e427d3ee7347585761f1f7a0e Mon Sep 17 00:00:00 2001 From: LordMZTE Date: Mon, 29 Jul 2024 17:02:44 +0200 Subject: [PATCH] add nix package for wrapped jdtls --- nix/cgnix/nvim-tools/default.nix | 2 +- nix/pkgs/default.nix | 1 + nix/pkgs/jdtls-wrapped.nix | 11 +++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 nix/pkgs/jdtls-wrapped.nix diff --git a/nix/cgnix/nvim-tools/default.nix b/nix/cgnix/nvim-tools/default.nix index 93fb50e..242d152 100644 --- a/nix/cgnix/nvim-tools/default.nix +++ b/nix/cgnix/nvim-tools/default.nix @@ -23,7 +23,7 @@ let nativeBuildInputs = with pkgs; [ zig_0_12.hook git ]; }) (pkgs.callPackage ./haxe-language-server.nix { }) - jdt-language-server + config.output.packages.jdtls-wrapped lua-language-server (flakePkg "github:oxalica/nil") ocamlPackages.ocaml-lsp diff --git a/nix/pkgs/default.nix b/nix/pkgs/default.nix index f1c7d13..a788a55 100644 --- a/nix/pkgs/default.nix +++ b/nix/pkgs/default.nix @@ -1,6 +1,7 @@ { ... }: { imports = [ + ./jdtls-wrapped.nix ./thumbnailers.nix ]; } diff --git a/nix/pkgs/jdtls-wrapped.nix b/nix/pkgs/jdtls-wrapped.nix new file mode 100644 index 0000000..4ebb18c --- /dev/null +++ b/nix/pkgs/jdtls-wrapped.nix @@ -0,0 +1,11 @@ +# A wrapper around jdtls that provides the correct Java version + +{ pkgs, ... }: +{ + output.packages.jdtls-wrapped = pkgs.writeShellScriptBin "jdtls" '' + export PATH="$PATH:${pkgs.jre17_minimal}/bin" + export JAVA_HOME="${pkgs.jre17_minimal}" + + exec "${pkgs.jdt-language-server}/bin/jdtls" "$@" + ''; +}