From f16eb5fa42a237223490feaf94dda3bed35d7c7b Mon Sep 17 00:00:00 2001 From: Dan Vargas Date: Sun, 6 Feb 2022 19:25:23 -0700 Subject: [PATCH] migrate racket to nix --- packages/racket/8.3.0/build.sh | 10 ----- packages/racket/8.3.0/environment | 5 --- packages/racket/8.3.0/metadata.json | 5 --- packages/racket/8.3.0/run | 3 -- packages/racket/8.3.0/test.rkt | 3 -- runtimes/default.nix | 1 + runtimes/racket.nix | 61 +++++++++++++++++++++++++++++ 7 files changed, 62 insertions(+), 26 deletions(-) delete mode 100644 packages/racket/8.3.0/build.sh delete mode 100644 packages/racket/8.3.0/environment delete mode 100644 packages/racket/8.3.0/metadata.json delete mode 100644 packages/racket/8.3.0/run delete mode 100644 packages/racket/8.3.0/test.rkt create mode 100644 runtimes/racket.nix diff --git a/packages/racket/8.3.0/build.sh b/packages/racket/8.3.0/build.sh deleted file mode 100644 index 187aef4..0000000 --- a/packages/racket/8.3.0/build.sh +++ /dev/null @@ -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 "" to racket.sh -echo "no -4 -" | sh racket.sh - diff --git a/packages/racket/8.3.0/environment b/packages/racket/8.3.0/environment deleted file mode 100644 index 1a30eef..0000000 --- a/packages/racket/8.3.0/environment +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -# Path to racket binary -export PATH=$PWD/bin:$PATH -export RACKET_PATH=$PWD/racket \ No newline at end of file diff --git a/packages/racket/8.3.0/metadata.json b/packages/racket/8.3.0/metadata.json deleted file mode 100644 index 14b902c..0000000 --- a/packages/racket/8.3.0/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "racket", - "version": "8.3.0", - "aliases": ["rkt"] -} diff --git a/packages/racket/8.3.0/run b/packages/racket/8.3.0/run deleted file mode 100644 index 227bfaa..0000000 --- a/packages/racket/8.3.0/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -"$RACKET_PATH"/bin/racket "$@" \ No newline at end of file diff --git a/packages/racket/8.3.0/test.rkt b/packages/racket/8.3.0/test.rkt deleted file mode 100644 index 7e0825c..0000000 --- a/packages/racket/8.3.0/test.rkt +++ /dev/null @@ -1,3 +0,0 @@ -#lang racket - -(display "OK") \ No newline at end of file diff --git a/runtimes/default.nix b/runtimes/default.nix index 5131bb6..cbefe12 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -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; } diff --git a/runtimes/racket.nix b/runtimes/racket.nix new file mode 100644 index 0000000..e20172f --- /dev/null +++ b/runtimes/racket.nix @@ -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"; + }) + ]; +} \ No newline at end of file