WIP: shell.nix

This commit is contained in:
Daniel Langbein 2024-11-19 19:17:15 +01:00
parent e57ca4030d
commit 21012c1c2b
Signed by: langfingaz
GPG Key ID: 6C47C753F0823002
2 changed files with 37 additions and 0 deletions

19
shell (Copy).nix Normal file
View File

@ -0,0 +1,19 @@
{ pkgs ? import <nixpkgs> { } }:
let
unstable = import (fetchTarball https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz) { };
jdk = unstable.jdk23;
in
# Open issue: gradle's toolchain support does not work with IntelliJ
# Solution from 2022 did no longer work: https://github.com/NixOS/nixpkgs/issues/207153#issue-1506967648
# Instead we found this: https://discourse.nixos.org/t/overriding-the-jdk-for-gradle-in-a-nix-flake/36541/2
pkgs.mkShell {
buildInputs = with pkgs; [
jdk
(callPackage gradle-packages.gradle_8 {
java = jdk;
})
];
}

18
shell.nix Normal file
View File

@ -0,0 +1,18 @@
{ pkgs ? import <nixpkgs> { } }:
let
unstable = import (fetchTarball https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz) { };
toolchains = [ unstable.jdk23 ];
in
pkgs.mkShell {
nativeBuildInputs = [
(unstable.gradle.overrideAttrs (curr: old: {
fixupPhase = ''
cat > $out/lib/gradle/gradle.properties <<EOF
org.gradle.java.installations.paths=${pkgs.lib.concatStringsSep "," toolchains}
EOF
'';
}))
];
}