Java: Difference between revisions
| Line 24: | Line 24: | ||
== VSCode + Language Support for Java (TM) by Red Hat extension == | == VSCode + Language Support for Java (TM) by Red Hat extension == | ||
Unfortunately the extension makes use of dynamically loaded libraries which nix cannot accomodate out-of-the-box. Fortunately there's a simple solution in the use of [https://github.com/Mic92/nix-ld nix-ld]. Here's a simple flake.nix to get you started (I'll focus on the devShell part for brevity): | Unfortunately the extension makes use of dynamically loaded libraries which nix cannot accomodate out-of-the-box. Fortunately there's a simple solution in the use of [https://github.com/Mic92/nix-ld nix-ld]. Here's a simple flake.nix to get you started (I'll focus on the devShell part for brevity):<syntaxhighlight lang="nix"> | ||
devShell = pkgs.mkShell { | devShell = pkgs.mkShell { | ||
buildInputs = [ | |||
buildInputs = [ | pkgs.gradle | ||
pkgs.jdk17 | |||
pkgs.gradle | ]; | ||
NIX_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ | |||
pkgs.jdk17 | pkgs.stdenv.cc.cc | ||
pkgs.openssl | |||
]; | ]; | ||
NIX_LD = pkgs.lib.fileContents "${pkgs.stdenv.cc}/nix-support/dynamic-linker"; # this needs .direnv:use flake --impure | |||
NIX_LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath [ | }; | ||
</syntaxhighlight>The important lines are the two lines starting with "NIX_LD...". They will let nix-ld wrap the required, dynamically loaded libraries so that they are found when building the devShell. | |||
pkgs.stdenv.cc.cc | |||
pkgs.openssl | |||
]; | |||
NIX_LD = pkgs.lib.fileContents "${pkgs.stdenv.cc}/nix-support/dynamic-linker"; # this needs .direnv:use flake --impure | |||
}; | |||
The important lines are the two lines starting with "NIX_LD...". They will let nix-ld wrap the required, dynamically loaded libraries so that they are found when building the devShell. | |||
== Using Oracle JDK instead of Open JDK == | == Using Oracle JDK instead of Open JDK == | ||