mirror of
https://gitlab.uni-marburg.de/langbeid/powersort.git
synced 2025-01-21 19:50:35 +01:00
shell.nix
This commit is contained in:
parent
cce05b328e
commit
7ccdfe497c
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,5 +1,4 @@
|
||||
/.idea
|
||||
/.sgp
|
||||
|
||||
# Ignore Gradle project-specific cache directory
|
||||
/.gradle
|
||||
|
24
README.md
24
README.md
@ -4,21 +4,17 @@
|
||||
|
||||
### Setup
|
||||
|
||||
Dependencies (JDK23, Gradle, IntelliJ) can be installed by running `nix-shell`.
|
||||
|
||||
**Commandline**
|
||||
|
||||
Check which Java toolchains can be found by Gradle:
|
||||
Check which Java toolchains Gradle finds:
|
||||
|
||||
```shell
|
||||
./gradlew javaToolchains
|
||||
```
|
||||
|
||||
- `shell.nix` -> broken (as well for `gradle javaToolchains`
|
||||
- `shell1.nix` -> works 🥳
|
||||
- `shell2.nix` -> broken (as well for `gradle javaToolchains`)
|
||||
- `shell3.nix` -> works 🥳
|
||||
- `shell4.nix` -> works 🥳
|
||||
|
||||
This should include version >= 17, e.g.:
|
||||
This should include version >= 23, e.g.:
|
||||
|
||||
```
|
||||
+ N/A JDK 23-ga
|
||||
@ -32,24 +28,14 @@ This should include version >= 17, e.g.:
|
||||
|
||||
**IntelliJ**
|
||||
|
||||
Open issue: gradle's toolchain support does not work with IntelliJ
|
||||
When using `nix-shell`, some configuration is necessary:
|
||||
|
||||
- `shell.nix`
|
||||
- Solution from 2022 did no longer work: https://github.com/NixOS/nixpkgs/issues/207153#issue-1506967648
|
||||
- `shell1.nix`
|
||||
- Instead, we found this: https://discourse.nixos.org/t/overriding-the-jdk-for-gradle-in-a-nix-flake/36541/2
|
||||
- `shell2.nix`
|
||||
- Another approach - which did no longer work! https://github.com/utybo/Tegral/blob/main/shell.nix
|
||||
- `shell3.nix`
|
||||
- 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
|
||||
|
||||
|
31
shell.nix
31
shell.nix
@ -1,18 +1,27 @@
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
# Gradle's toolchain support does not work with IntelliJ, thus we have to use buildFHSUserEnv
|
||||
|
||||
# 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) { };
|
||||
toolchains = [ unstable.jdk23 ];
|
||||
jdk = unstable.jdk23;
|
||||
gradle = unstable.gradle;
|
||||
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
|
||||
'';
|
||||
}))
|
||||
(
|
||||
pkgs.buildFHSUserEnv
|
||||
{
|
||||
name = "intellij-gradle-jdk23";
|
||||
targetPkgs = pkgs_: [
|
||||
pkgs_.jetbrains.idea-ultimate
|
||||
jdk
|
||||
gradle
|
||||
];
|
||||
}
|
||||
).env
|
||||
|
15
shell1.nix
15
shell1.nix
@ -1,15 +0,0 @@
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
|
||||
let
|
||||
unstable = import (fetchTarball https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz) { };
|
||||
jdk = unstable.jdk23;
|
||||
in
|
||||
|
||||
pkgs.mkShell {
|
||||
buildInputs = with pkgs; [
|
||||
jdk
|
||||
(callPackage gradle-packages.gradle_8 {
|
||||
java = jdk;
|
||||
})
|
||||
];
|
||||
}
|
66
shell2.nix
66
shell2.nix
@ -1,66 +0,0 @@
|
||||
{ pkgs ? import <nixpkgs> { } }:
|
||||
|
||||
let
|
||||
unstable = import (fetchTarball https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz) { };
|
||||
toolchains = [ (unstable.jdk11 + "/lib/openjdk") (unstable.jdk17 + "/lib/openjdk") ];
|
||||
patchedGradle = unstable.gradle_8.overrideAttrs (curr: old: {
|
||||
fixupPhase = (old.fixupPhase or "") + ''
|
||||
cat > $out/lib/gradle/gradle.properties <<EOF
|
||||
org.gradle.java.installations.paths=${unstable.lib.concatStringsSep "," toolchains}
|
||||
EOF
|
||||
'';
|
||||
});
|
||||
nodePackages18 = unstable.nodePackages.override { nodejs = unstable.nodejs-18_x; };
|
||||
in
|
||||
unstable.mkShell {
|
||||
nativeBuildInputs = [
|
||||
patchedGradle
|
||||
unstable.nodejs-18_x
|
||||
nodePackages18.pnpm
|
||||
unstable.prisma-engines
|
||||
nodePackages18.prisma
|
||||
];
|
||||
shellHook = ''
|
||||
export PRISMA_MIGRATION_ENGINE_BINARY="${unstable.prisma-engines}/bin/schema-engine"
|
||||
export PRISMA_QUERY_ENGINE_BINARY="${unstable.prisma-engines}/bin/query-engine"
|
||||
export PRISMA_QUERY_ENGINE_LIBRARY="${unstable.prisma-engines}/lib/libquery_engine.node"
|
||||
export PRISMA_INTROSPECTION_ENGINE_BINARY="${unstable.prisma-engines}/bin/introspection-engine"
|
||||
export PRISMA_FMT_BINARY="${unstable.prisma-engines}/bin/prisma-fmt"
|
||||
export PATH="$PATH:$PWD/node_modules/.bin"
|
||||
|
||||
export GRADLE_HOME=${patchedGradle}
|
||||
echo -e '\033[0;33m!!! Run ./.sgp (set gradle path) from the root of this repository BEFORE running IntelliJ IDEA !!!\033[0m'
|
||||
echo -e '\033[0;33m(restart IntelliJ IDEA if you already started it)\033[0m'
|
||||
|
||||
cat > ./.sgp <<EOS
|
||||
#!/bin/sh
|
||||
mkdir -p .idea
|
||||
rm -f .idea/gradle.xml
|
||||
cat > .idea/gradle.xml <<EOF
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="delegatedBuild" value="true" />
|
||||
<option name="testRunner" value="GRADLE" />
|
||||
<option name="distributionType" value="LOCAL" />
|
||||
<option name="externalProjectPath" value="\\\$PROJECT_DIR\\\$" />
|
||||
<option name="gradleHome" value="${patchedGradle}/lib/gradle" />
|
||||
<option name="gradleJvm" value="#JAVA_HOME" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="\\\$PROJECT_DIR\\\$" />
|
||||
</set>
|
||||
</option>
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
EOF
|
||||
echo IntelliJ IDEA configured, restart running instances
|
||||
EOS
|
||||
chmod +x ./.sgp
|
||||
'';
|
||||
}
|
||||
|
22
shell3.nix
22
shell3.nix
@ -1,22 +0,0 @@
|
||||
# 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;
|
||||
}
|
||||
}:
|
||||
(
|
||||
pkgs.buildFHSUserEnv
|
||||
{
|
||||
name = "foo";
|
||||
targetPkgs = pkgs_:
|
||||
[
|
||||
pkgs_.jetbrains.idea-ultimate
|
||||
|
||||
# Gradle 8.7 is configured for JDK 21
|
||||
pkgs_.jdk
|
||||
pkgs_.gradle
|
||||
|
||||
];
|
||||
}
|
||||
).env
|
25
shell4.nix
25
shell4.nix
@ -1,25 +0,0 @@
|
||||
# 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
|
Loading…
x
Reference in New Issue
Block a user