diff --git a/runtimes/default.nix b/runtimes/default.nix index f7b30c3..d25201b 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -33,4 +33,5 @@ args: { "nim" = import ./nim.nix args; "nasm" = import ./nasm.nix args; "nasm-nasm64" = import ./nasm-nasm64.nix args; + "mono-csharp" = import ./mono-csharp.nix args; } diff --git a/runtimes/mono-csharp.nix b/runtimes/mono-csharp.nix new file mode 100644 index 0000000..7be9078 --- /dev/null +++ b/runtimes/mono-csharp.nix @@ -0,0 +1,49 @@ +{pkgs, piston, ...}: +let + pkg = pkgs.mono; +in piston.mkRuntime { + language = "csharp"; + version = pkg.version; + runtime = "mono"; + + aliases = [ + "mono" + "mono-csharp" + "mono-c#" + "mono-cs" + "c#" + "cs" + ]; + + compile = '' + rename 's/$/\.cs/' "$@" # Add .cs extension + ${pkg}/bin/csc -out:out *.cs + ''; + + run = '' + shift + ${pkg}/bin/mono out "$@" + ''; + + tests = [ + (piston.mkTest { + files = { + "test.cs" = '' + using System; + + public class Test + { + public static void Main(string[] args) + { + Console.WriteLine("OK"); + } + } + ''; + }; + args = []; + stdin = ""; + packages = []; + main = "test.cs"; + }) + ]; +} \ No newline at end of file