From ab536f35ffef3027a5a32e6c89c67af81800c5ae Mon Sep 17 00:00:00 2001 From: Dan Vargas Date: Sun, 6 Feb 2022 21:45:52 -0700 Subject: [PATCH] migrate nim pkg to nix --- packages/nim/1.4.4/build.sh | 18 ------------------ packages/nim/1.4.4/compile | 5 ----- packages/nim/1.4.4/environment | 1 - packages/nim/1.4.4/metadata.json | 5 ----- packages/nim/1.4.4/run | 4 ---- packages/nim/1.4.4/test.nim | 1 - runtimes/default.nix | 1 + runtimes/nim.nix | 32 ++++++++++++++++++++++++++++++++ 8 files changed, 33 insertions(+), 34 deletions(-) delete mode 100755 packages/nim/1.4.4/build.sh delete mode 100644 packages/nim/1.4.4/compile delete mode 100644 packages/nim/1.4.4/environment delete mode 100644 packages/nim/1.4.4/metadata.json delete mode 100644 packages/nim/1.4.4/run delete mode 100644 packages/nim/1.4.4/test.nim create mode 100644 runtimes/nim.nix diff --git a/packages/nim/1.4.4/build.sh b/packages/nim/1.4.4/build.sh deleted file mode 100755 index 1bb0bee..0000000 --- a/packages/nim/1.4.4/build.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -PREFIX=$(realpath $(dirname $0)) - -mkdir -p build - -cd build - -# Prebuilt binary - source *can* be built, but it requires gcc -curl -L "https://nim-lang.org/download/nim-1.4.4-linux_x64.tar.xz" -o nim.tar.xz -tar xf nim.tar.xz --strip-components=1 -rm nim.tar.xz - -./install.sh "$PREFIX" - -cd ../ - -rm -rf build diff --git a/packages/nim/1.4.4/compile b/packages/nim/1.4.4/compile deleted file mode 100644 index 91dc0ba..0000000 --- a/packages/nim/1.4.4/compile +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -# Compile nim file(s) -nim --hints:off --out:out --nimcache:./ c "$@" -chmod +x out diff --git a/packages/nim/1.4.4/environment b/packages/nim/1.4.4/environment deleted file mode 100644 index 872a1f3..0000000 --- a/packages/nim/1.4.4/environment +++ /dev/null @@ -1 +0,0 @@ -export PATH=$PWD/nim/bin:$PATH \ No newline at end of file diff --git a/packages/nim/1.4.4/metadata.json b/packages/nim/1.4.4/metadata.json deleted file mode 100644 index f23eb0e..0000000 --- a/packages/nim/1.4.4/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "nim", - "version": "1.4.4", - "aliases": ["nim"] -} diff --git a/packages/nim/1.4.4/run b/packages/nim/1.4.4/run deleted file mode 100644 index 6955ba9..0000000 --- a/packages/nim/1.4.4/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash - -shift # Filename is only used to compile -./out "$@" diff --git a/packages/nim/1.4.4/test.nim b/packages/nim/1.4.4/test.nim deleted file mode 100644 index 6c57628..0000000 --- a/packages/nim/1.4.4/test.nim +++ /dev/null @@ -1 +0,0 @@ -echo("OK") \ No newline at end of file diff --git a/runtimes/default.nix b/runtimes/default.nix index 8da8f44..478b0fd 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -30,4 +30,5 @@ args: { "perl" = import ./perl.nix args; "octave" = import ./octave.nix args; "ocaml" = import ./ocaml.nix args; + "nim" = import ./nim.nix args; } diff --git a/runtimes/nim.nix b/runtimes/nim.nix new file mode 100644 index 0000000..f76cc02 --- /dev/null +++ b/runtimes/nim.nix @@ -0,0 +1,32 @@ +{pkgs, piston, ...}: +let + pkg = pkgs.nim; +in piston.mkRuntime { + language = "nim"; + version = pkg.version; + aliases = []; + + compile = '' + ${pkg}/bin/nim --hints:off --out:out --nimcache:./ c "$@" + chmod +x out + ''; + + run = '' + shift + ./out "$@" + ''; + + tests = [ + (piston.mkTest { + files = { + "test.nim" = '' + echo("OK") + ''; + }; + args = []; + stdin = ""; + packages = []; + main = "test.nim"; + }) + ]; +} \ No newline at end of file