WIP: shell.nix

This commit is contained in:
Daniel Langbein 2024-11-23 16:39:45 +00:00
parent cc91066b05
commit ca7f049c83
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
3 changed files with 30 additions and 2 deletions

View File

@ -16,6 +16,7 @@ Check which Java toolchains can be found by Gradle:
- `shell1.nix` -> works 🥳
- `shell2.nix` -> broken (as well for `gradle javaToolchains`)
- `shell3.nix` -> works 🥳
- `shell4.nix` -> works 🥳
This should include version >= 17, e.g.:
@ -40,13 +41,15 @@ Open issue: gradle's toolchain support does not work with IntelliJ
- `shell2.nix`
- Another approach - which did no longer work! https://github.com/utybo/Tegral/blob/main/shell.nix
- `shell3.nix`
- This works 🥳
- This works with JDK 21 🥳
- STRG ALT SHIFT s -> SDK -> add JDK ->
- home path: /usr/lib/openjdk
- name: usr-lib-jdk
- STRG ALT s -> build tools -> gradle ->
- local installation: /usr/lib/gradle
- Gradle JVM: usr-lib-jdk
- `shell4.nix`
- This works with JDK23 🚀
### Tasks

View File

@ -28,7 +28,7 @@ dependencies {
// Apply a specific Java toolchain to ease working on different environments.
java {
toolchain {
languageVersion = JavaLanguageVersion.of(22)
languageVersion = JavaLanguageVersion.of(23)
}
}

25
shell4.nix Normal file
View File

@ -0,0 +1,25 @@
# https://discourse.nixos.org/t/how-to-create-a-development-environment-with-intellij-idea-and-openjdk/10153
{
pkgs ? import <nixpkgs> {
# https://github.com/NixOS/nixpkgs/issues/166220#issuecomment-1745803058
config.allowUnfree = true;
}
}:
let
unstable = import (fetchTarball https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz) { };
jdk = unstable.jdk23;
gradle = unstable.gradle;
in
(
pkgs.buildFHSUserEnv
{
name = "foo2";
targetPkgs = pkgs_: [
pkgs_.jetbrains.idea-ultimate
jdk
gradle
];
}
).env