migrate racket to nix

This commit is contained in:
Dan Vargas 2022-02-06 19:25:23 -07:00
parent 54510b713e
commit f16eb5fa42
7 changed files with 62 additions and 26 deletions

View File

@ -1,10 +0,0 @@
#!/usr/bin/env bash
# curl racket 8.3 linux installation shell file
curl -L 'https://download.racket-lang.org/installers/8.3/racket-8.3-x86_64-linux-cs.sh' -o racket.sh
# provide settings "no" "4" and "<CR>" to racket.sh
echo "no
4
" | sh racket.sh

View File

@ -1,5 +0,0 @@
#!/bin/bash
# Path to racket binary
export PATH=$PWD/bin:$PATH
export RACKET_PATH=$PWD/racket

View File

@ -1,5 +0,0 @@
{
"language": "racket",
"version": "8.3.0",
"aliases": ["rkt"]
}

View File

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

View File

@ -1,3 +0,0 @@
#lang racket
(display "OK")

View File

@ -22,4 +22,5 @@ args: {
"sqlite3" = import ./sqlite3.nix args;
"rscript" = import ./rscript.nix args;
"raku" = import ./raku.nix args;
"racket" = import ./racket.nix args;
}

61
runtimes/racket.nix Normal file
View File

@ -0,0 +1,61 @@
{pkgs, piston, ...}:
let
pkg = pkgs.racket-minimal;
in piston.mkRuntime {
language = "racket";
version = pkg.version;
aliases = [
"rkt"
];
run = ''
${pkg}/bin/racket "$@"
'';
tests = [
# test different file extension
(piston.mkTest {
files = {
"file.code" = ''
#lang racket
(display "OK")
'';
};
args = [];
stdin = "";
packages = [];
main = "file.code";
})
#test argv
(piston.mkTest {
files = {
"test.rkt" = ''
#lang racket
(for ([arg (current-command-line-arguments)]) (displayln arg))
'';
};
args = ["OK"];
stdin = "";
packages = [];
main = "test.rkt";
})
# test stdin
(piston.mkTest {
files = {
"test.rkt" = ''
#lang racket
(let loop ()
(match (read-char)
[(? eof-object?) (void)]
[c (display c)
(loop)]))
'';
};
args = [];
stdin = "OK";
packages = [];
main = "test.rkt";
})
];
}