add piston nix pkg for jvm-kotlin
This commit is contained in:
parent
2d7609f5a2
commit
58a46e3b0a
|
@ -1,13 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Download and extract JDK8
|
|
||||||
curl -L "https://github.com/AdoptOpenJDK/openjdk8-binaries/releases/download/jdk8u292-b10/OpenJDK8U-jdk_x64_linux_hotspot_8u292b10.tar.gz" -o jdk.tar.gz
|
|
||||||
tar xzf jdk.tar.gz --strip-components=1
|
|
||||||
rm jdk.tar.gz
|
|
||||||
|
|
||||||
# Download and extract Kotlin
|
|
||||||
curl -L "https://github.com/JetBrains/kotlin/releases/download/v1.4.31/kotlin-compiler-1.4.31.zip" -o kotlin.zip
|
|
||||||
unzip kotlin.zip
|
|
||||||
rm kotlin.zip
|
|
||||||
cp -r kotlinc/* .
|
|
||||||
rm -rf kotlinc
|
|
|
@ -1,6 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
rename 's/$/\.kt/' "$@" # Add .kt extension
|
|
||||||
|
|
||||||
# Compile Kotlin code to a jar file
|
|
||||||
kotlinc *.kt -include-runtime -d code.jar
|
|
|
@ -1,4 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Add java and kotlinc to path
|
|
||||||
export PATH=$PWD/bin:$PATH
|
|
|
@ -1,5 +0,0 @@
|
||||||
{
|
|
||||||
"language": "kotlin",
|
|
||||||
"version": "1.4.31",
|
|
||||||
"aliases": ["kt"]
|
|
||||||
}
|
|
|
@ -1,5 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Run jar file
|
|
||||||
shift
|
|
||||||
java -jar code.jar "$@"
|
|
|
@ -1,3 +0,0 @@
|
||||||
fun main() {
|
|
||||||
println("OK")
|
|
||||||
}
|
|
|
@ -37,4 +37,5 @@ args: {
|
||||||
"lua" = import ./lua.nix args;
|
"lua" = import ./lua.nix args;
|
||||||
"lolcode" = import ./lolcode.nix args;
|
"lolcode" = import ./lolcode.nix args;
|
||||||
"sbcl-lisp" = import ./sbcl-lisp.nix args;
|
"sbcl-lisp" = import ./sbcl-lisp.nix args;
|
||||||
|
"jvm-kotlin" = import ./jvm-kotlin.nix args;
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
{pkgs, piston, ...}:
|
||||||
|
let
|
||||||
|
pkg = pkgs.kotlin;
|
||||||
|
jre = pkgs.jre;
|
||||||
|
in piston.mkRuntime {
|
||||||
|
language = "kotlin";
|
||||||
|
version = pkg.version;
|
||||||
|
runtime = "jvm";
|
||||||
|
|
||||||
|
aliases = [
|
||||||
|
"kt"
|
||||||
|
];
|
||||||
|
|
||||||
|
compile = ''
|
||||||
|
rename 's/$/\.kt/' "$@" # Add .kt extension
|
||||||
|
${pkg}/bin/kotlinc *.kt -include-runtime -d code.jar
|
||||||
|
'';
|
||||||
|
|
||||||
|
run = ''
|
||||||
|
shift
|
||||||
|
${jre}/bin/java -jar code.jar "$@"
|
||||||
|
'';
|
||||||
|
|
||||||
|
tests = [
|
||||||
|
(piston.mkTest {
|
||||||
|
files = {
|
||||||
|
"test.kt" = ''
|
||||||
|
fun main() {
|
||||||
|
println("OK")
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
args = [];
|
||||||
|
stdin = "";
|
||||||
|
packages = [];
|
||||||
|
main = "test.kt";
|
||||||
|
})
|
||||||
|
];
|
||||||
|
}
|
Loading…
Reference in New Issue