nix-git/shell-intellij-gradle-openjdk.nix

40 lines
1.1 KiB
Nix

# Example from my (non public) Software Quality course homework.
# That (private) repo might contain a more up to date version.
{ }:
let
### Import nixpkgs with Niv ###
#
sources = import ./nix/sources.nix;
# nixpkgs stable
pkgs = import sources.nixpkgs {
# Required for IntelliJ Ultimate
config.allowUnfree = true;
};
# https://github.com/NixOS/nixpkgs/blob/d9e98537533e7d978556bd58739813a47db5d591/pkgs/top-level/all-packages.nix#L14078-L14083
jdk = pkgs.jdk23.override {
enableJavaFX = true;
openjfx_jdk = pkgs.openjfx23.override { withWebKit = true; };
};
# https://github.com/NixOS/nixpkgs/blob/23e89b7da85c3640bbc2173fe04f4bd114342367/pkgs/development/tools/build-managers/gradle/default.nix#L46
gradle = pkgs.gradle.override {
java = jdk;
javaToolchains = [ jdk ];
};
in
(
# Gradle's toolchain support does not work with IntelliJ, thus we have to use buildFHSUserEnv
pkgs.buildFHSUserEnv
{
name = "intellij-gradle-jdk23";
targetPkgs = pkgs_: [
pkgs_.jetbrains.idea-ultimate
jdk
gradle
];
}
).env