add mono csharp

This commit is contained in:
Dan Vargas 2022-02-07 11:04:40 -07:00
parent d258bed574
commit d688ec3fe3
2 changed files with 50 additions and 0 deletions

View File

@ -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;
}

49
runtimes/mono-csharp.nix Normal file
View File

@ -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";
})
];
}