add piston nix pkg for coffeescript]

This commit is contained in:
Dan Vargas 2022-03-18 11:16:41 -06:00
parent 96ffdb63dd
commit 2490833ef1
7 changed files with 58 additions and 20 deletions

View File

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

View File

@ -1 +0,0 @@
export PATH=$PWD/bin:$PATH

View File

@ -1,5 +0,0 @@
{
"language": "coffeescript",
"version": "2.5.1",
"aliases": ["coffeescript", "coffee"]
}

View File

@ -1,3 +0,0 @@
#!/bin/bash
coffee "$@"

View File

@ -1 +0,0 @@
console.log "OK"

View File

@ -59,4 +59,5 @@ args: {
"dotnet-sdk-visual-basic" = import ./dotnet-sdk-visual-basic.nix args; "dotnet-sdk-visual-basic" = import ./dotnet-sdk-visual-basic.nix args;
"fpc-pascal" = import ./fpc-pascal.nix args; "fpc-pascal" = import ./fpc-pascal.nix args;
"brainfuck" = import ./brainfuck.nix args; "brainfuck" = import ./brainfuck.nix args;
"node-coffeescript" = import ./node-coffeescript.nix args;
} }

View File

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