mirror of
https://gitlab.uni-marburg.de/langbeid/powersort.git
synced 2025-01-21 19:50:35 +01:00
WIP: shell.nix
This commit is contained in:
parent
21012c1c2b
commit
b8c1b79916
6
.gitignore
vendored
6
.gitignore
vendored
@ -1,5 +1,7 @@
|
||||
/.sgp
|
||||
|
||||
# Ignore Gradle project-specific cache directory
|
||||
.gradle
|
||||
/.gradle
|
||||
|
||||
# Ignore Gradle build output directory
|
||||
build
|
||||
/build
|
||||
|
19
README.md
19
README.md
@ -4,12 +4,18 @@
|
||||
|
||||
### Setup
|
||||
|
||||
**Commandline**
|
||||
|
||||
Check which Java toolchains can be found by Gradle:
|
||||
|
||||
```shell
|
||||
./gradlew javaToolchains
|
||||
```
|
||||
|
||||
- `shell.nix` -> broken (as well for `gradle javaToolchains`
|
||||
- `shell1.nix` -> works
|
||||
- `shell2.nix` -> broken (as well for `gradle javaToolchains`)
|
||||
|
||||
This should include version >= 17, e.g.:
|
||||
|
||||
```
|
||||
@ -22,6 +28,19 @@ This should include version >= 17, e.g.:
|
||||
| Detected by: Current JVM
|
||||
```
|
||||
|
||||
**IntelliJ**
|
||||
|
||||
TODO, nothing has worked so far.
|
||||
|
||||
Open issue: gradle's toolchain support does not work with IntelliJ
|
||||
|
||||
- `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
|
||||
|
||||
### Tasks
|
||||
|
||||
List all Gradle tasks which can be run:
|
||||
|
@ -5,10 +5,6 @@ let
|
||||
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
|
66
shell2.nix
Normal file
66
shell2.nix
Normal file
@ -0,0 +1,66 @@
|
||||
{ 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
|
||||
'';
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user