piston/runtimes/vlang.nix

40 lines
744 B
Nix
Raw Normal View History

2022-02-02 19:13:33 +01:00
{pkgs, piston, ...}:
let
pkg = pkgs.vlang;
in piston.mkRuntime {
language = "vlang";
version = pkg.version;
aliases = [
"v"
];
run = ''
# vlang env
export VMODULES="$PWD"
export TMPDIR="$PWD"
# modify file extension
mv "$1" "$1.v"
filename="$1.v"
shift
${pkg}/bin/v run "$filename" "$@"
'';
tests = [
(piston.mkTest {
files = {
"file0.code" = ''
fn main() {
println('OK')
}
'';
};
args = [];
stdin = "";
packages = [];
main = "file0.code";
})
];
}