Merge pull request #460 from dvargas46/add-nix-packages
more nix packages
This commit is contained in:
commit
61a833ca3c
|
@ -1,22 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Put instructions to build your package in here
|
||||
PREFIX=$(realpath $(dirname $0))
|
||||
|
||||
git clone https://github.com/fabianishere/brainfuck.git
|
||||
|
||||
cd brainfuck
|
||||
git checkout 06f84462e0a96487670a4b8024e3ec531e0377ee
|
||||
|
||||
|
||||
mkdir -p build
|
||||
|
||||
cd build
|
||||
|
||||
cmake .. -DCMAKE_INSTALL_PREFIX=$PREFIX/ -DENABLE_EDITLINE=OFF
|
||||
|
||||
make -j$(nproc)
|
||||
make install -j$(nproc)
|
||||
|
||||
cd ../../
|
||||
rm -rf brainfuck
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Put 'export' statements here for environment variables
|
||||
export PATH=$PWD/bin:$PATH
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"language": "brainfuck",
|
||||
"version": "2.7.3",
|
||||
"aliases": ["bf"]
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Put instructions to run the runtime
|
||||
fold -w1 | brainfuck $1
|
|
@ -1 +0,0 @@
|
|||
-[--->+<]>------.----.
|
|
@ -1,10 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Download and install NodeJS
|
||||
curl "https://nodejs.org/dist/v15.10.0/node-v15.10.0-linux-x64.tar.xz" -o node.tar.xz
|
||||
tar xf node.tar.xz --strip-components=1
|
||||
rm node.tar.xz
|
||||
export PATH=$PWD/bin:$PATH
|
||||
|
||||
# Install CoffeeScript via npm and done
|
||||
npm install --global coffeescript@2.5.1
|
|
@ -1 +0,0 @@
|
|||
export PATH=$PWD/bin:$PATH
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"language": "coffeescript",
|
||||
"version": "2.5.1",
|
||||
"aliases": ["coffeescript", "coffee"]
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
coffee "$@"
|
|
@ -1 +0,0 @@
|
|||
console.log "OK"
|
|
@ -1,6 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
curl -L "https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.1/clang+llvm-12.0.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz" -o llvm-ir.tar.xz
|
||||
|
||||
tar xf llvm-ir.tar.xz clang+llvm-12.0.1-x86_64-linux-gnu-ubuntu-/bin --strip-components=1
|
||||
|
||||
rm llvm-ir.tar.xz
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
llc "$@" -o binary.s
|
||||
clang binary.s -o binary
|
|
@ -1,2 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
export PATH=$PWD/bin:$PATH
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"language": "llvm_ir",
|
||||
"version": "12.0.1",
|
||||
"aliases": ["llvm", "llvm-ir", "ll"]
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
shift
|
||||
binary "$@"
|
|
@ -1,10 +0,0 @@
|
|||
@.str = private unnamed_addr constant [2 x i8] c"OK"
|
||||
|
||||
declare i32 @puts(i8* nocapture) nounwind
|
||||
|
||||
define i32 @main() {
|
||||
%cast210 = getelementptr [2 x i8],[2 x i8]* @.str, i64 0, i64 0
|
||||
|
||||
call i32 @puts(i8* %cast210)
|
||||
ret i32 0
|
||||
}
|
|
@ -1,32 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
PREFIX=$(realpath $(dirname $0))
|
||||
|
||||
mkdir -p build/mono build/mono-basic
|
||||
cd build
|
||||
|
||||
curl "https://download.mono-project.com/sources/mono/mono-6.12.0.122.tar.xz" -o mono.tar.xz
|
||||
curl -L "https://github.com/mono/mono-basic/archive/refs/tags/4.7.tar.gz" -o mono-basic.tar.gz
|
||||
tar xf mono.tar.xz --strip-components=1 -C mono
|
||||
tar xf mono-basic.tar.gz --strip-components=1 -C mono-basic
|
||||
|
||||
# Compiling Mono
|
||||
cd mono
|
||||
|
||||
./configure --prefix "$PREFIX"
|
||||
|
||||
make -j$(nproc)
|
||||
make install -j$(nproc)
|
||||
|
||||
export PATH="$PREFIX/bin:$PATH" # To be able to use mono commands
|
||||
|
||||
# Compiling mono-basic
|
||||
cd ../mono-basic
|
||||
./configure --prefix="$PREFIX"
|
||||
|
||||
make -j$(nproc) PLATFORM="linux" # Avoids conflict with the $PLATFORM variable we have
|
||||
make install -j$(nproc) PLATFORM="linux"
|
||||
|
||||
# Remove redundant files
|
||||
cd ../../
|
||||
rm -rf build
|
|
@ -1,16 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
case "${PISTON_LANGUAGE}" in
|
||||
csharp)
|
||||
rename 's/$/\.cs/' "$@" # Add .cs extension
|
||||
csc -out:out *.cs
|
||||
;;
|
||||
basic)
|
||||
rename 's/$/\.vb/' "$@" # Add .vb extension
|
||||
vbnc -out:out *.vb
|
||||
;;
|
||||
*)
|
||||
echo "How did you get here? (${PISTON_LANGUAGE})"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
|
@ -1 +0,0 @@
|
|||
export PATH=$PWD/bin:$PATH
|
|
@ -1,20 +0,0 @@
|
|||
{
|
||||
"language": "mono",
|
||||
"version": "6.12.0",
|
||||
"provides": [
|
||||
{
|
||||
"language": "csharp",
|
||||
"aliases": ["mono", "mono-csharp", "mono-c#", "mono-cs", "c#", "cs"]
|
||||
},
|
||||
{
|
||||
"language": "basic",
|
||||
"aliases": [
|
||||
"vb",
|
||||
"mono-vb",
|
||||
"mono-basic",
|
||||
"visual-basic",
|
||||
"visual basic"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
shift
|
||||
mono out "$@"
|
|
@ -1,9 +0,0 @@
|
|||
using System;
|
||||
|
||||
public class Test
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
Console.WriteLine("OK");
|
||||
}
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
Imports System
|
||||
|
||||
Module Module1
|
||||
|
||||
Sub Main()
|
||||
Console.WriteLine("OK")
|
||||
End Sub
|
||||
|
||||
End Module
|
|
@ -1,11 +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 Scala 3
|
||||
curl -L "https://github.com/lampepfl/dotty/releases/download/3.0.0/scala3-3.0.0.tar.gz" -o scala.tar.gz
|
||||
tar -xzf scala.tar.gz --strip-components=1
|
||||
rm scala.tar.gz
|
|
@ -1,15 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Compile scala classes into a jar file
|
||||
scalac "$@" -d out.jar
|
||||
|
||||
# Create the Manifest and include scala lib jars:
|
||||
# NOTE: - entry point will only consider @main and App traits from the main file
|
||||
# - scala lib jars will be added to the class path in order to run the jar properly
|
||||
echo "Main-Class: $(grep -oP '\@main\s+def\s+\K[a-zA-Z][a-zA-Z0-9]*|object\s+\K[a-zA-Z][a-zA-Z0-9]*(?=\s+extends\s+App)' $1)
|
||||
Class-Path: $(echo $JAVA_HOME/lib/*.jar | sed 's/\s/\n /g')
|
||||
|
||||
" > manifest.txt
|
||||
|
||||
# Update the jar with the manifest
|
||||
jar ufm out.jar manifest.txt
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Scala requires JAVA_HOME to be set
|
||||
export JAVA_HOME=$PWD
|
||||
export PATH=$PWD/bin:$PATH
|
|
@ -1,5 +0,0 @@
|
|||
{
|
||||
"language": "scala",
|
||||
"version": "3.0.0",
|
||||
"aliases": ["sc"]
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Run jar file
|
||||
shift
|
||||
java -jar out.jar "$@"
|
|
@ -1,3 +0,0 @@
|
|||
@main def run(): Unit = {
|
||||
println("OK")
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
{pkgs, piston, ...}:
|
||||
let
|
||||
# All other BF packages are either marked as broken in nix-pkgs
|
||||
# or have missing functionality. Yabi isn't perfect either.
|
||||
pkg = pkgs.haskellPackages.yabi;
|
||||
in piston.mkRuntime {
|
||||
language = "brainfuck";
|
||||
version = pkg.version;
|
||||
|
||||
aliases = [
|
||||
"bf"
|
||||
"yabi"
|
||||
];
|
||||
|
||||
run = ''
|
||||
# Yabi produces messages when parsing the BF file that are sent to stderr
|
||||
# Yabi will also break when trying to take more input at EOF
|
||||
${pkg}/bin/yabi "$1" 2> /dev/null
|
||||
'';
|
||||
|
||||
tests = [
|
||||
# stdout test
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.bf" = ''-[--->+<]>------.----.'';
|
||||
};
|
||||
args = [];
|
||||
stdin = "";
|
||||
packages = [];
|
||||
main = "test.bf";
|
||||
})
|
||||
|
||||
# stdin test
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.bf" = '',.,.'';
|
||||
};
|
||||
args = [];
|
||||
stdin = "OK";
|
||||
packages = [];
|
||||
main = "test.bf";
|
||||
})
|
||||
|
||||
# bf doesn't take args test
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.bf" = ''-[--->+<]>------.----.'';
|
||||
};
|
||||
args = ["OK"];
|
||||
stdin = "";
|
||||
packages = [];
|
||||
main = "test.bf";
|
||||
})
|
||||
];
|
||||
}
|
|
@ -58,4 +58,9 @@ args: {
|
|||
"dotnet-sdk-fsharp-interactive" = import ./dotnet-sdk-fsharp-interactive.nix args;
|
||||
"dotnet-sdk-visual-basic" = import ./dotnet-sdk-visual-basic.nix args;
|
||||
"fpc-pascal" = import ./fpc-pascal.nix args;
|
||||
"brainfuck" = import ./brainfuck.nix args;
|
||||
"node-coffeescript" = import ./node-coffeescript.nix args;
|
||||
"jvm-scala" = import ./jvm-scala.nix args;
|
||||
"llvm_ir" = import ./llvm_ir.nix args;
|
||||
"mono-basic" = import ./mono-basic.nix args;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
{pkgs, piston, ...}:
|
||||
let
|
||||
pkg = pkgs.scala;
|
||||
java = pkgs.jdk8;
|
||||
sed = pkgs.gnused;
|
||||
in piston.mkRuntime {
|
||||
language = "scala";
|
||||
version = pkg.version;
|
||||
runtime = "jvm";
|
||||
|
||||
aliases = [
|
||||
"sc"
|
||||
];
|
||||
|
||||
compile = ''
|
||||
# Compile scala classes into a jar file
|
||||
${pkg}/bin/scalac "$@" -d out.jar
|
||||
|
||||
# Capture extra class-path libraries
|
||||
java_libs="$(echo ${java}/lib/openjdk/lib/*.jar | ${sed}/bin/sed 's/\s/\\n /g')"
|
||||
scala_libs="$(echo ${pkg}/lib/*.jar | ${sed}/bin/sed 's/\s/\\n /g')"
|
||||
|
||||
echo -e "Class-Path: $java_libs
|
||||
$scala_libs
|
||||
" > classPath
|
||||
|
||||
# Update the jar manifest with scala libs
|
||||
${java}/bin/jar umf classPath out.jar
|
||||
'';
|
||||
|
||||
run = ''
|
||||
# Run jar from compile
|
||||
shift
|
||||
${java}/bin/java -jar out.jar "$@"
|
||||
'';
|
||||
|
||||
tests = [
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.sc" = ''
|
||||
object Main {
|
||||
def main(args: Array[String]) = {
|
||||
println("OK")
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
args = [];
|
||||
stdin = "";
|
||||
packages = [];
|
||||
main = "test.sc";
|
||||
})
|
||||
];
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
{pkgs, piston, ...}:
|
||||
let
|
||||
pkg = pkgs.llvm;
|
||||
clang = pkgs.llvmPackages_13.libcxxClang;
|
||||
in piston.mkRuntime {
|
||||
language = "llvm_ir";
|
||||
version = clang.version;
|
||||
|
||||
aliases = [
|
||||
"llvm"
|
||||
"llvm-ir"
|
||||
"ll"
|
||||
];
|
||||
|
||||
compile = ''
|
||||
${pkg}/bin/llc "$@" -o binary.s
|
||||
${clang}/bin/clang binary.s -o binary
|
||||
'';
|
||||
|
||||
run = ''
|
||||
shift
|
||||
./binary "$@"
|
||||
'';
|
||||
|
||||
tests = [
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.ll" = ''
|
||||
@.str = private unnamed_addr constant [2 x i8] c"OK"
|
||||
|
||||
declare i32 @puts(i8* nocapture) nounwind
|
||||
|
||||
define i32 @main() {
|
||||
%cast210 = getelementptr [2 x i8],[2 x i8]* @.str, i64 0, i64 0
|
||||
|
||||
call i32 @puts(i8* %cast210)
|
||||
ret i32 0
|
||||
}
|
||||
'';
|
||||
};
|
||||
args = [];
|
||||
stdin = "";
|
||||
packages = [];
|
||||
main = "test.ll";
|
||||
})
|
||||
];
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
{pkgs, piston, ...}:
|
||||
let
|
||||
pkg = pkgs.mono;
|
||||
in piston.mkRuntime {
|
||||
language = "basic";
|
||||
version = pkg.version;
|
||||
runtime = "mono";
|
||||
|
||||
aliases = [
|
||||
"vb"
|
||||
"mono-vb"
|
||||
"mono-basic"
|
||||
"visual-basic"
|
||||
];
|
||||
|
||||
compile = ''
|
||||
rename 's/$/\.vb/' "$@" # Add .vb extension
|
||||
${pkg}/bin/vbc -out:out -sdkpath:${pkg}/lib/mono/4.8-api *.vb
|
||||
'';
|
||||
|
||||
run = ''
|
||||
shift
|
||||
${pkg}/bin/mono out.exe "$@"
|
||||
'';
|
||||
|
||||
tests = [
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.vb" = ''
|
||||
Imports System
|
||||
|
||||
Module Module1
|
||||
|
||||
Sub Main()
|
||||
Console.WriteLine("OK")
|
||||
End Sub
|
||||
|
||||
End Module
|
||||
'';
|
||||
};
|
||||
args = [];
|
||||
stdin = "";
|
||||
packages = [];
|
||||
main = "test.vb";
|
||||
})
|
||||
];
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
{pkgs, piston, ...}:
|
||||
let
|
||||
pkg = pkgs.nodePackages.coffee-script;
|
||||
in piston.mkRuntime {
|
||||
language = "coffeescript";
|
||||
version = pkg.version;
|
||||
runtime = "node";
|
||||
|
||||
aliases = [
|
||||
"coffee"
|
||||
];
|
||||
|
||||
run = ''
|
||||
${pkg}/bin/coffee "$@"
|
||||
'';
|
||||
|
||||
tests = [
|
||||
# stdout test
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.coffee" = ''
|
||||
console.log "OK"
|
||||
'';
|
||||
};
|
||||
args = [];
|
||||
stdin = "";
|
||||
packages = [];
|
||||
main = "test.coffee";
|
||||
})
|
||||
|
||||
# args test
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.coffee" = ''
|
||||
console.log process.argv[2]
|
||||
'';
|
||||
};
|
||||
args = ["OK"];
|
||||
stdin = "";
|
||||
packages = [];
|
||||
main = "test.coffee";
|
||||
})
|
||||
|
||||
# stdin test
|
||||
(piston.mkTest {
|
||||
files = {
|
||||
"test.coffee" = ''
|
||||
process.stdin.on('data', (data) => console.log(data.toString()))
|
||||
'';
|
||||
};
|
||||
args = [];
|
||||
stdin = "OK";
|
||||
packages = [];
|
||||
main = "test.coffee";
|
||||
})
|
||||
];
|
||||
}
|
Loading…
Reference in New Issue