Add fsharp-interactive

This commit is contained in:
Omar Brikaa 2022-02-24 17:46:20 +02:00
parent c203aa3774
commit c4ceaa6964
2 changed files with 53 additions and 0 deletions

View File

@ -55,4 +55,5 @@ args: {
"rust" = import ./rust.nix args; "rust" = import ./rust.nix args;
"dotnet-sdk-csharp" = import ./dotnet-sdk-csharp.nix args; "dotnet-sdk-csharp" = import ./dotnet-sdk-csharp.nix args;
"dotnet-sdk-fsharp" = import ./dotnet-sdk-fsharp.nix args; "dotnet-sdk-fsharp" = import ./dotnet-sdk-fsharp.nix args;
"dotnet-sdk-fsharp-interactive" = import ./dotnet-sdk-fsharp-interactive.nix args;
} }

View File

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