From 6161997f49d9fd3ec347a239737f27d25b06631b Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Mon, 21 Feb 2022 14:48:43 +0200 Subject: [PATCH 1/7] Added ADA via GNAT 11.2.0 --- runtimes/default.nix | 1 + runtimes/gnat-ada.nix | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 runtimes/gnat-ada.nix diff --git a/runtimes/default.nix b/runtimes/default.nix index 140fd83..47bd12f 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -51,4 +51,5 @@ args: { "gcc-fortran" = import ./gcc-fortran.nix args; "yabasic" = import ./yabasic.nix args; "emacs" = import ./emacs.nix args; + "gnat-ada" = import ./gnat-ada.nix args; } diff --git a/runtimes/gnat-ada.nix b/runtimes/gnat-ada.nix new file mode 100644 index 0000000..ef7695b --- /dev/null +++ b/runtimes/gnat-ada.nix @@ -0,0 +1,41 @@ +{pkgs, piston, ...}: +let + pkg = pkgs.gnat; +in piston.mkRuntime { + language = "ada"; + version = pkg.version; + runtime = "gnat"; + + aliases = [ + "adb" + "ads" + ]; + + compile = '' + ${pkg}/bin/gnatmake "$@" -o a.out + ''; + + run = '' + shift + ./a.out "$@" + ''; + + tests = [ + (piston.mkTest { + files = { + "test.adb" = '' + with Text_IO; use Text_IO; + with Ada.Command_line; use Ada.Command_Line; + procedure hello is + begin + Put_Line(Argument(1)); + end hello; + ''; + }; + args = ["OK"]; + stdin = ""; + packages = []; + main = "test.adb"; + }) + ]; +} From a739cff448251d7f45a293fe0b2f6795f2503f41 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Mon, 21 Feb 2022 20:49:09 +0200 Subject: [PATCH 2/7] Add rust 1.57.0 --- packages/rust/1.50.0/build.sh | 5 ---- packages/rust/1.50.0/compile | 6 ---- packages/rust/1.50.0/environment | 5 ---- packages/rust/1.50.0/metadata.json | 5 ---- packages/rust/1.50.0/run | 4 --- packages/rust/1.50.0/test.rs | 3 -- packages/rust/1.56.1/build.sh | 5 ---- packages/rust/1.56.1/compile | 6 ---- packages/rust/1.56.1/environment | 5 ---- packages/rust/1.56.1/metadata.json | 7 ----- packages/rust/1.56.1/run | 4 --- packages/rust/1.56.1/test.rs | 3 -- runtimes/default.nix | 1 + runtimes/rust.nix | 47 ++++++++++++++++++++++++++++++ 14 files changed, 48 insertions(+), 58 deletions(-) delete mode 100755 packages/rust/1.50.0/build.sh delete mode 100644 packages/rust/1.50.0/compile delete mode 100644 packages/rust/1.50.0/environment delete mode 100644 packages/rust/1.50.0/metadata.json delete mode 100644 packages/rust/1.50.0/run delete mode 100644 packages/rust/1.50.0/test.rs delete mode 100644 packages/rust/1.56.1/build.sh delete mode 100644 packages/rust/1.56.1/compile delete mode 100644 packages/rust/1.56.1/environment delete mode 100644 packages/rust/1.56.1/metadata.json delete mode 100644 packages/rust/1.56.1/run delete mode 100644 packages/rust/1.56.1/test.rs create mode 100644 runtimes/rust.nix diff --git a/packages/rust/1.50.0/build.sh b/packages/rust/1.50.0/build.sh deleted file mode 100755 index c3e41b1..0000000 --- a/packages/rust/1.50.0/build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -curl -OL "https://static.rust-lang.org/dist/rust-1.50.0-x86_64-unknown-linux-gnu.tar.gz" -tar xzvf rust-1.50.0-x86_64-unknown-linux-gnu.tar.gz -rm rust-1.50.0-x86_64-unknown-linux-gnu.tar.gz diff --git a/packages/rust/1.50.0/compile b/packages/rust/1.50.0/compile deleted file mode 100644 index 201318a..0000000 --- a/packages/rust/1.50.0/compile +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# https://stackoverflow.com/questions/38041331/rust-compiler-cant-find-crate-for-std -# Rust compiler needs to find the stdlib to link against -rustc -o binary -L ${RUST_INSTALL_LOC}/rustc/lib -L ${RUST_INSTALL_LOC}/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib "$@" -chmod +x binary diff --git a/packages/rust/1.50.0/environment b/packages/rust/1.50.0/environment deleted file mode 100644 index 2a704ee..0000000 --- a/packages/rust/1.50.0/environment +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -# Put 'export' statements here for environment variables -export PATH=$PWD/rust-1.50.0-x86_64-unknown-linux-gnu/rustc/bin/:$PATH -export RUST_INSTALL_LOC=$PWD/rust-1.50.0-x86_64-unknown-linux-gnu diff --git a/packages/rust/1.50.0/metadata.json b/packages/rust/1.50.0/metadata.json deleted file mode 100644 index 57cefa0..0000000 --- a/packages/rust/1.50.0/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "rust", - "version": "1.50.0", - "aliases": ["rs"] -} diff --git a/packages/rust/1.50.0/run b/packages/rust/1.50.0/run deleted file mode 100644 index d377dd9..0000000 --- a/packages/rust/1.50.0/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -shift -./binary "$@" diff --git a/packages/rust/1.50.0/test.rs b/packages/rust/1.50.0/test.rs deleted file mode 100644 index 9561664..0000000 --- a/packages/rust/1.50.0/test.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("OK"); -} diff --git a/packages/rust/1.56.1/build.sh b/packages/rust/1.56.1/build.sh deleted file mode 100644 index 6be556f..0000000 --- a/packages/rust/1.56.1/build.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -curl -OL "https://static.rust-lang.org/dist/rust-1.56.1-x86_64-unknown-linux-gnu.tar.gz" -tar xzvf rust-1.56.1-x86_64-unknown-linux-gnu.tar.gz -rm rust-1.56.1-x86_64-unknown-linux-gnu.tar.gz diff --git a/packages/rust/1.56.1/compile b/packages/rust/1.56.1/compile deleted file mode 100644 index 201318a..0000000 --- a/packages/rust/1.56.1/compile +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# https://stackoverflow.com/questions/38041331/rust-compiler-cant-find-crate-for-std -# Rust compiler needs to find the stdlib to link against -rustc -o binary -L ${RUST_INSTALL_LOC}/rustc/lib -L ${RUST_INSTALL_LOC}/rust-std-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib "$@" -chmod +x binary diff --git a/packages/rust/1.56.1/environment b/packages/rust/1.56.1/environment deleted file mode 100644 index c28b1b7..0000000 --- a/packages/rust/1.56.1/environment +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -# Put 'export' statements here for environment variables -export PATH=$PWD/rust-1.56.1-x86_64-unknown-linux-gnu/rustc/bin/:$PATH -export RUST_INSTALL_LOC=$PWD/rust-1.56.1-x86_64-unknown-linux-gnu diff --git a/packages/rust/1.56.1/metadata.json b/packages/rust/1.56.1/metadata.json deleted file mode 100644 index 1f7319a..0000000 --- a/packages/rust/1.56.1/metadata.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "language": "rust", - "version": "1.56.1", - "aliases": [ - "rs" - ] -} diff --git a/packages/rust/1.56.1/run b/packages/rust/1.56.1/run deleted file mode 100644 index d377dd9..0000000 --- a/packages/rust/1.56.1/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -shift -./binary "$@" diff --git a/packages/rust/1.56.1/test.rs b/packages/rust/1.56.1/test.rs deleted file mode 100644 index 9561664..0000000 --- a/packages/rust/1.56.1/test.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("OK"); -} diff --git a/runtimes/default.nix b/runtimes/default.nix index 47bd12f..5a8c6a2 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -52,4 +52,5 @@ args: { "yabasic" = import ./yabasic.nix args; "emacs" = import ./emacs.nix args; "gnat-ada" = import ./gnat-ada.nix args; + "rust" = import ./rust.nix args; } diff --git a/runtimes/rust.nix b/runtimes/rust.nix new file mode 100644 index 0000000..4e4b6a4 --- /dev/null +++ b/runtimes/rust.nix @@ -0,0 +1,47 @@ +{pkgs, piston, ...}: +let + gccPackage = pkgs.gcc; # gcc is required for the linker + pkg = pkgs.rustc; +in piston.mkRuntime { + language = "rust"; + version = pkg.version; + + aliases = [ + "rs" + ]; + + compile = '' + ${pkg}/bin/rustc -o binary -C linker=${gccPackage}/bin/gcc $1 + chmod +x binary + ''; + + run = '' + shift + ./binary "$@" + ''; + + tests = [ + (piston.mkTest { + files = { + "test.rs" = '' + pub mod helper; + use std::env; + + fn main() { + let args: Vec = env::args().collect(); + helper::print_something(args[1].to_string()); + } + ''; + "helper.rs" = '' + pub fn print_something(what: String) -> () { + println!("{}", what); + } + ''; + }; + args = ["OK"]; + stdin = ""; + packages = []; + main = "test.rs"; + }) + ]; +} From fa2d192d155f6b0f38ebc1d4e7e9d9e332fdab7e Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Wed, 23 Feb 2022 14:37:34 +0200 Subject: [PATCH 3/7] Add dotnet csharp --- runtimes/default.nix | 1 + runtimes/dotnet-sdk-csharp.nix | 81 ++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 runtimes/dotnet-sdk-csharp.nix diff --git a/runtimes/default.nix b/runtimes/default.nix index 5a8c6a2..3d9f65c 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -53,4 +53,5 @@ args: { "emacs" = import ./emacs.nix args; "gnat-ada" = import ./gnat-ada.nix args; "rust" = import ./rust.nix args; + "dotnet-sdk-csharp" = import ./dotnet-sdk-csharp.nix args; } diff --git a/runtimes/dotnet-sdk-csharp.nix b/runtimes/dotnet-sdk-csharp.nix new file mode 100644 index 0000000..86b3837 --- /dev/null +++ b/runtimes/dotnet-sdk-csharp.nix @@ -0,0 +1,81 @@ +{pkgs, piston, ...}: +let + nugetPkg = pkgs.stdenv.mkDerivation { + pname = "csharp-nuget-packages"; + version = pkgs.dotnet-sdk.version; + + dontUnpack = true; + dontBuild = true; + dontConfigure = true; + dontFixup = true; + dontPatch = true; + + buildInputs = [ + pkgs.dotnet-sdk + ]; + installPhase = '' + mkdir $out + cd $out + export HOME=$PWD + dotnet new console -o cache_application + rm -rf cache_application + ''; + }; + pkg = pkgs.dotnet-sdk; +in piston.mkRuntime { + language = "csharp"; + version = pkg.version; + runtime = "dotnet-sdk"; + + aliases = [ + "csharp.net" + "c#" + "cs" + "c#.net" + "cs.net" + "c#-dotnet" + "cs-dotnet" + "csharp-dotnet" + "dotnet-c#" + "dotnet-cs" + "dotnet-csharp" + ]; + + compile = '' + export HOME=${nugetPkg} + ${pkg}/dotnet build --help > /dev/null # Supress welcome message + rename 's/$/\.cs/' "$@" # Add .cs extension + ${pkg}/dotnet new console -o . --no-restore + rm Program.cs + ${pkg}/dotnet restore --source ${nugetPkg}/.nuget/packages + ${pkg}/dotnet build --no-restore + ''; + + run = '' + export HOME=$PWD + shift + ${pkg}/dotnet bin/Debug/net6.0/$(basename $(realpath .)).dll "$@" + ''; + + tests = [ + (piston.mkTest { + files = { + "test.cs" = '' + using System; + + public class Test + { + public static void Main(string[] args) + { + Console.WriteLine(args[0]); + } + } + ''; + }; + args = ["OK"]; + stdin = ""; + packages = []; + main = "test.cs"; + }) + ]; +} From c203aa37742042c7c183a9123866ff37e8eec606 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Wed, 23 Feb 2022 15:18:40 +0200 Subject: [PATCH 4/7] Added dotnet fsharp --- runtimes/default.nix | 1 + runtimes/dotnet-sdk-fsharp.nix | 80 ++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 runtimes/dotnet-sdk-fsharp.nix diff --git a/runtimes/default.nix b/runtimes/default.nix index 3d9f65c..9dab5f6 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -54,4 +54,5 @@ args: { "gnat-ada" = import ./gnat-ada.nix args; "rust" = import ./rust.nix args; "dotnet-sdk-csharp" = import ./dotnet-sdk-csharp.nix args; + "dotnet-sdk-fsharp" = import ./dotnet-sdk-fsharp.nix args; } diff --git a/runtimes/dotnet-sdk-fsharp.nix b/runtimes/dotnet-sdk-fsharp.nix new file mode 100644 index 0000000..be0ca26 --- /dev/null +++ b/runtimes/dotnet-sdk-fsharp.nix @@ -0,0 +1,80 @@ +{pkgs, piston, ...}: +let + nugetPkg = pkgs.stdenv.mkDerivation { + pname = "fsharp-nuget-packages"; + version = pkgs.dotnet-sdk.version; + + dontUnpack = true; + dontBuild = true; + dontConfigure = true; + dontFixup = true; + dontPatch = true; + + buildInputs = [ + pkgs.dotnet-sdk + ]; + installPhase = '' + mkdir $out + cd $out + export HOME=$PWD + dotnet new console -lang F# -o fs_cache_application + rm -rf fs_cache_application + ''; + }; + pkg = pkgs.dotnet-sdk; +in piston.mkRuntime { + language = "fsharp"; + version = pkg.version; + runtime = "dotnet-sdk"; + + aliases = [ + "fsharp.net" + "fs" + "f#" + "fs.net" + "f#.net" + "fsharp-dotnet" + "fs-dotnet" + "f#-dotnet" + "dotnet-fsharp" + "dotnet-fs" + "dotnet-fs" + ]; + + compile = '' + export HOME=${nugetPkg} + ${pkg}/dotnet build --help > /dev/null # Supress welcome message + first_file=$1 + shift + rename 's/$/\.fs/' "$@" # Add .fs extension + ${pkg}/dotnet new console -lang F# -o . --no-restore + mv $first_file Program.fs + ${pkg}/dotnet restore --source ${nugetPkg}/.nuget/packages + ${pkg}/dotnet build --no-restore + ''; + + run = '' + export HOME=${nugetPkg} + shift + ${pkg}/dotnet bin/Debug/net6.0/$(basename $(realpath .)).dll "$@" + ''; + + tests = [ + (piston.mkTest { + files = { + "test.fs" = '' + open System + + [] + let main argv = + Console.WriteLine argv[0] + 0 + ''; + }; + args = ["OK"]; + stdin = ""; + packages = []; + main = "test.fs"; + }) + ]; +} From c4ceaa696412ca8724e7e143c9fcb7dbc2eb05b9 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Thu, 24 Feb 2022 17:46:20 +0200 Subject: [PATCH 5/7] Add fsharp-interactive --- runtimes/default.nix | 1 + runtimes/dotnet-sdk-fsharp-interactive.nix | 52 ++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 runtimes/dotnet-sdk-fsharp-interactive.nix diff --git a/runtimes/default.nix b/runtimes/default.nix index 9dab5f6..27466cb 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -55,4 +55,5 @@ args: { "rust" = import ./rust.nix args; "dotnet-sdk-csharp" = import ./dotnet-sdk-csharp.nix args; "dotnet-sdk-fsharp" = import ./dotnet-sdk-fsharp.nix args; + "dotnet-sdk-fsharp-interactive" = import ./dotnet-sdk-fsharp-interactive.nix args; } diff --git a/runtimes/dotnet-sdk-fsharp-interactive.nix b/runtimes/dotnet-sdk-fsharp-interactive.nix new file mode 100644 index 0000000..9e77db1 --- /dev/null +++ b/runtimes/dotnet-sdk-fsharp-interactive.nix @@ -0,0 +1,52 @@ +{pkgs, piston, ...}: +let + pkg = pkgs.dotnet-sdk; +in piston.mkRuntime { + language = "fsharp-interactive"; + version = pkg.version; + runtime = "dotnet-sdk"; + + aliases = [ + "fsi" + "fsx" + "fsi.net" + "fsi-dotnet" + "dotnet-fsi" + "fsharp-interactive.net" + "fsharp-interactive-dotnet" + "dotnet-fsharp-interactive" + "f#-interactive" + "f#-interactive.net" + "f#-interactive-dotnet" + "dotnet-f#-interactive" + "fs-interactive" + "fs-interactive.net" + "fs-interactive-dotnet" + "dotnet-fs-interactive" + ]; + + run = '' + export HOME=$PWD + FILENAME=$1 + rename 's/$/\.fsx/' $FILENAME # Add .fsx extension + shift + ${pkg}/dotnet fsi --help > /dev/null + ${pkg}/dotnet fsi $FILENAME.fsx "$@" + ''; + + tests = [ + (piston.mkTest { + files = { + "test.fsx" = '' + open System + let args : string array = fsi.CommandLineArgs |> Array.tail + Console.WriteLine args[0] + ''; + }; + args = ["OK"]; + stdin = ""; + packages = []; + main = "test.fsx"; + }) + ]; +} From 45ee6253386a96049845b80d2b44f2e716e051b9 Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Fri, 25 Feb 2022 14:41:16 +0200 Subject: [PATCH 6/7] Add dotnet visual-basic --- packages/dotnet/5.0.201/build.sh | 16 ------ packages/dotnet/5.0.201/compile | 36 ------------ packages/dotnet/5.0.201/environment | 6 -- packages/dotnet/5.0.201/metadata.json | 66 --------------------- packages/dotnet/5.0.201/run | 25 -------- packages/dotnet/5.0.201/test.cs | 9 --- packages/dotnet/5.0.201/test.fs | 6 -- packages/dotnet/5.0.201/test.fsx | 1 - packages/dotnet/5.0.201/test.vb | 9 --- runtimes/default.nix | 1 + runtimes/dotnet-sdk-visual-basic.nix | 82 +++++++++++++++++++++++++++ 11 files changed, 83 insertions(+), 174 deletions(-) delete mode 100755 packages/dotnet/5.0.201/build.sh delete mode 100644 packages/dotnet/5.0.201/compile delete mode 100644 packages/dotnet/5.0.201/environment delete mode 100644 packages/dotnet/5.0.201/metadata.json delete mode 100644 packages/dotnet/5.0.201/run delete mode 100644 packages/dotnet/5.0.201/test.cs delete mode 100644 packages/dotnet/5.0.201/test.fs delete mode 100644 packages/dotnet/5.0.201/test.fsx delete mode 100644 packages/dotnet/5.0.201/test.vb create mode 100644 runtimes/dotnet-sdk-visual-basic.nix diff --git a/packages/dotnet/5.0.201/build.sh b/packages/dotnet/5.0.201/build.sh deleted file mode 100755 index 6318b07..0000000 --- a/packages/dotnet/5.0.201/build.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash - -curl "https://download.visualstudio.microsoft.com/download/pr/73a9cb2a-1acd-4d20-b864-d12797ca3d40/075dbe1dc3bba4aa85ca420167b861b6/dotnet-sdk-5.0.201-linux-x64.tar.gz" -Lo dotnet.tar.gz -tar xzf dotnet.tar.gz --strip-components=1 -rm dotnet.tar.gz - -# Cache nuget packages -export DOTNET_CLI_HOME=$PWD -./dotnet new console -o cache_application -./dotnet new console -lang F# -o fs_cache_application -./dotnet new console -lang VB -o vb_cache_application -# This calls a restore on the global-packages index ($DOTNET_CLI_HOME/.nuget/packages) -# If we want to allow more packages, we could add them to this cache_application - -rm -rf cache_application fs_cache_application vb_cache_application -# Get rid of it, we don't actually need the application - just the restore diff --git a/packages/dotnet/5.0.201/compile b/packages/dotnet/5.0.201/compile deleted file mode 100644 index 1c34213..0000000 --- a/packages/dotnet/5.0.201/compile +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env bash - -[ "${PISTON_LANGUAGE}" == "fsi" ] && exit 0 - -export DOTNET_CLI_HOME=$PWD -export HOME=$PWD - -dotnet build --help > /dev/null # Shut the thing up - -case "${PISTON_LANGUAGE}" in - basic.net) - rename 's/$/\.vb/' "$@" # Add .vb extension - dotnet new console -lang VB -o . --no-restore - rm Program.vb - ;; - fsharp.net) - first_file=$1 - shift - rename 's/$/\.fs/' "$@" # Add .fs extension - dotnet new console -lang F# -o . --no-restore - mv $first_file Program.fs # For some reason F#.net doesn't work unless the file name is Program.fs - ;; - csharp.net) - rename 's/$/\.cs/' "$@" # Add .cs extension - dotnet new console -o . --no-restore - rm Program.cs - ;; - *) - echo "How did you get here? (${PISTON_LANGUAGE})" - exit 1 - ;; - -esac - -dotnet restore --source $DOTNET_ROOT/.nuget/packages -dotnet build --no-restore diff --git a/packages/dotnet/5.0.201/environment b/packages/dotnet/5.0.201/environment deleted file mode 100644 index 468463d..0000000 --- a/packages/dotnet/5.0.201/environment +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash - -# Put 'export' statements here for environment variables -export DOTNET_ROOT=$PWD -export PATH=$DOTNET_ROOT:$PATH -export FSI_PATH=$(find $(pwd) -name fsi.dll) diff --git a/packages/dotnet/5.0.201/metadata.json b/packages/dotnet/5.0.201/metadata.json deleted file mode 100644 index 7c73c58..0000000 --- a/packages/dotnet/5.0.201/metadata.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "language": "dotnet", - "version": "5.0.201", - "provides": [ - { - "language": "basic.net", - "aliases": [ - "basic", - "visual-basic", - "visual-basic.net", - "vb", - "vb.net", - "vb-dotnet", - "dotnet-vb", - "basic-dotnet", - "dotnet-basic" - ], - "limit_overrides": { "max_process_count": 128 } - }, - { - "language": "fsharp.net", - "aliases": [ - "fsharp", - "fs", - "f#", - "fs.net", - "f#.net", - "fsharp-dotnet", - "fs-dotnet", - "f#-dotnet", - "dotnet-fsharp", - "dotnet-fs", - "dotnet-fs" - ], - "limit_overrides": { "max_process_count": 128 } - }, - { - "language": "csharp.net", - "aliases": [ - "csharp", - "c#", - "cs", - "c#.net", - "cs.net", - "c#-dotnet", - "cs-dotnet", - "csharp-dotnet", - "dotnet-c#", - "dotnet-cs", - "dotnet-csharp" - ], - "limit_overrides": { "max_process_count": 128 } - }, - { - "language": "fsi", - "aliases": [ - "fsx", - "fsharp-interactive", - "f#-interactive", - "dotnet-fsi", - "fsi-dotnet", - "fsi.net" - ] - } - ] -} diff --git a/packages/dotnet/5.0.201/run b/packages/dotnet/5.0.201/run deleted file mode 100644 index 6b5c995..0000000 --- a/packages/dotnet/5.0.201/run +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash - -# Put instructions to run the runtime -export DOTNET_CLI_HOME=$PWD - -case "${PISTON_LANGUAGE}" in - basic.net) - ;& - fsharp.net) - ;& - csharp.net) - shift - dotnet bin/Debug/net5.0/$(basename $(realpath .)).dll "$@" - ;; - fsi) - FILENAME=$1 - rename 's/$/\.fsx/' $FILENAME # Add .fsx extension - shift - dotnet $FSI_PATH $FILENAME.fsx "$@" - ;; - *) - echo "How did you get here? (${PISTON_LANGUAGE})" - exit 1 - ;; -esac diff --git a/packages/dotnet/5.0.201/test.cs b/packages/dotnet/5.0.201/test.cs deleted file mode 100644 index e91a2a2..0000000 --- a/packages/dotnet/5.0.201/test.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System; - -public class Test -{ - public static void Main(string[] args) - { - Console.WriteLine("OK"); - } -} \ No newline at end of file diff --git a/packages/dotnet/5.0.201/test.fs b/packages/dotnet/5.0.201/test.fs deleted file mode 100644 index 006ac10..0000000 --- a/packages/dotnet/5.0.201/test.fs +++ /dev/null @@ -1,6 +0,0 @@ -open System - -[] -let main argv = - printfn "OK" - 0 diff --git a/packages/dotnet/5.0.201/test.fsx b/packages/dotnet/5.0.201/test.fsx deleted file mode 100644 index 33d166f..0000000 --- a/packages/dotnet/5.0.201/test.fsx +++ /dev/null @@ -1 +0,0 @@ -printfn "OK" diff --git a/packages/dotnet/5.0.201/test.vb b/packages/dotnet/5.0.201/test.vb deleted file mode 100644 index 291042e..0000000 --- a/packages/dotnet/5.0.201/test.vb +++ /dev/null @@ -1,9 +0,0 @@ -Imports System - -Module Module1 - - Sub Main() - Console.WriteLine("OK") - End Sub - -End Module diff --git a/runtimes/default.nix b/runtimes/default.nix index 27466cb..286c4e1 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -56,4 +56,5 @@ args: { "dotnet-sdk-csharp" = import ./dotnet-sdk-csharp.nix args; "dotnet-sdk-fsharp" = import ./dotnet-sdk-fsharp.nix args; "dotnet-sdk-fsharp-interactive" = import ./dotnet-sdk-fsharp-interactive.nix args; + "dotnet-sdk-visual-basic" = import ./dotnet-sdk-visual-basic.nix args; } diff --git a/runtimes/dotnet-sdk-visual-basic.nix b/runtimes/dotnet-sdk-visual-basic.nix new file mode 100644 index 0000000..9953109 --- /dev/null +++ b/runtimes/dotnet-sdk-visual-basic.nix @@ -0,0 +1,82 @@ +{pkgs, piston, ...}: +let + pkg = pkgs.dotnet-sdk; + nugetPkg = pkgs.stdenv.mkDerivation { + pname = "visual-basic-nuget-packages"; + version = pkgs.dotnet-sdk.version; + + dontUnpack = true; + dontBuild = true; + dontConfigure = true; + dontFixup = true; + dontPatch = true; + + buildInputs = [ + pkgs.dotnet-sdk + ]; + installPhase = '' + mkdir $out + cd $out + export HOME=$PWD + dotnet new console -lang VB -o cache_application + rm -rf cache_application + ''; +}; + +in piston.mkRuntime { + language = "visual-basic"; + version = pkg.version; + runtime = "dotnet-sdk"; + + aliases = [ + "visual-basic.net" + "visual-basic-dotnet" + "dotnet-visual-basic" + "vb" + "vb.net" + "vb-dotnet" + "dotnet-vh" + "basic" + "basic.net" + "basic-dotnet" + "dotnet-basic" + ]; + + compile = '' + export HOME=${nugetPkg} + ${pkg}/dotnet build --help > /dev/null # Supress welcome message + rename 's/$/\.vb/' "$@" # Add .vb extension + ${pkg}/dotnet new console -lang VB -o . --no-restore + rm Program.vb + ${pkg}/dotnet restore --source ${nugetPkg}/.nuget/packages + ${pkg}/dotnet build --no-restore + ''; + + run = '' + export HOME=$PWD + shift + ${pkg}/dotnet bin/Debug/net6.0/$(basename $(realpath .)).dll "$@" + ''; + + tests = [ + (piston.mkTest { + files = { + "test.vb" = '' + Imports System + + Module Module1 + + Sub Main(args As String()) + Console.WriteLine(args(0)) + End Sub + + End Module + ''; + }; + args = ["OK"]; + stdin = ""; + packages = []; + main = "test.vb"; + }) + ]; +} From 88f2b5bed45e8b36475cb4108b62d4e1e549810a Mon Sep 17 00:00:00 2001 From: Omar Brikaa Date: Fri, 25 Feb 2022 14:51:26 +0200 Subject: [PATCH 7/7] Added Pascal --- packages/pascal/3.2.0/build.sh | 25 ---------------- packages/pascal/3.2.0/compile | 5 ---- packages/pascal/3.2.0/environment | 1 - packages/pascal/3.2.0/metadata.json | 5 ---- packages/pascal/3.2.0/run | 4 --- packages/pascal/3.2.0/test.pp | 5 ---- runtimes/default.nix | 1 + runtimes/fpc-pascal.nix | 44 +++++++++++++++++++++++++++++ 8 files changed, 45 insertions(+), 45 deletions(-) delete mode 100755 packages/pascal/3.2.0/build.sh delete mode 100644 packages/pascal/3.2.0/compile delete mode 100644 packages/pascal/3.2.0/environment delete mode 100644 packages/pascal/3.2.0/metadata.json delete mode 100644 packages/pascal/3.2.0/run delete mode 100644 packages/pascal/3.2.0/test.pp create mode 100644 runtimes/fpc-pascal.nix diff --git a/packages/pascal/3.2.0/build.sh b/packages/pascal/3.2.0/build.sh deleted file mode 100755 index 0d1a3b8..0000000 --- a/packages/pascal/3.2.0/build.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash - -PREFIX=$(realpath $(dirname $0)) - -mkdir -p build - -cd build -curl -L "https://sourceforge.net/projects/freepascal/files/Linux/3.2.0/fpc-3.2.0-x86_64-linux.tar/download" -o pascal.tar -tar xf pascal.tar --strip-components=1 - -# FreePascal uses an interactive installer -./install.sh << ANSWERS -$PREFIX -n -n -n -ANSWERS - -cd .. -rm -rf build - -# A sample config (needed for each "project") is written to /etc -# We'll copy that into the local lib dir (fpc searches there too on compile) -mkdir lib/fpc/etc -cp -r /etc/fp* lib/fpc/etc/ diff --git a/packages/pascal/3.2.0/compile b/packages/pascal/3.2.0/compile deleted file mode 100644 index 93855b7..0000000 --- a/packages/pascal/3.2.0/compile +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -# Compile pascal files -fpc -oout -v0 "$@" -chmod +x out diff --git a/packages/pascal/3.2.0/environment b/packages/pascal/3.2.0/environment deleted file mode 100644 index bd0ff98..0000000 --- a/packages/pascal/3.2.0/environment +++ /dev/null @@ -1 +0,0 @@ -export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/pascal/3.2.0/metadata.json b/packages/pascal/3.2.0/metadata.json deleted file mode 100644 index daaca4f..0000000 --- a/packages/pascal/3.2.0/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "pascal", - "version": "3.2.0", - "aliases": ["pascal", "freepascal", "pp", "pas"] -} diff --git a/packages/pascal/3.2.0/run b/packages/pascal/3.2.0/run deleted file mode 100644 index 6955ba9..0000000 --- a/packages/pascal/3.2.0/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -shift # Filename is only used to compile -./out "$@" diff --git a/packages/pascal/3.2.0/test.pp b/packages/pascal/3.2.0/test.pp deleted file mode 100644 index 3c5165d..0000000 --- a/packages/pascal/3.2.0/test.pp +++ /dev/null @@ -1,5 +0,0 @@ -program test; - - begin - writeln('OK'); - end. \ No newline at end of file diff --git a/runtimes/default.nix b/runtimes/default.nix index 286c4e1..b2cf206 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -57,4 +57,5 @@ args: { "dotnet-sdk-fsharp" = import ./dotnet-sdk-fsharp.nix 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; } diff --git a/runtimes/fpc-pascal.nix b/runtimes/fpc-pascal.nix new file mode 100644 index 0000000..46609f7 --- /dev/null +++ b/runtimes/fpc-pascal.nix @@ -0,0 +1,44 @@ +{pkgs, piston, ...}: +let + binutilsPkg = pkgs.binutils; + pkg = pkgs.fpc; +in piston.mkRuntime { + language = "pascal"; + version = pkg.version; + + runtime = "fpc"; + + aliases = [ + "freepascal" + "pp" + "pas" + ]; + + compile = '' + export PATH="${binutilsPkg}/bin:$PATH" + ${pkg}/bin/fpc -oout -v0 "$@" + chmod +x out + ''; + + run = '' + shift + ./out "$@" + ''; + + tests = [ + (piston.mkTest { + files = { + "test.pp" = '' + program test; + begin + writeln(paramStr(1)); + end. + ''; + }; + args = ["OK"]; + stdin = ""; + packages = []; + main = "test.pp"; + }) + ]; +}