From dc2c5f3380923bd9f72e615dcef577155dc596ec Mon Sep 17 00:00:00 2001 From: Dan Vargas Date: Sun, 6 Feb 2022 21:06:32 -0700 Subject: [PATCH] migrate ponylang to nix --- packages/ponylang/0.39.0/build.sh | 27 ------------------- packages/ponylang/0.39.0/compile | 5 ---- packages/ponylang/0.39.0/environment | 4 --- packages/ponylang/0.39.0/metadata.json | 5 ---- packages/ponylang/0.39.0/run | 6 ----- packages/ponylang/0.39.0/test.pony | 3 --- runtimes/default.nix | 1 + runtimes/ponylang.nix | 37 ++++++++++++++++++++++++++ 8 files changed, 38 insertions(+), 50 deletions(-) delete mode 100755 packages/ponylang/0.39.0/build.sh delete mode 100644 packages/ponylang/0.39.0/compile delete mode 100644 packages/ponylang/0.39.0/environment delete mode 100644 packages/ponylang/0.39.0/metadata.json delete mode 100644 packages/ponylang/0.39.0/run delete mode 100644 packages/ponylang/0.39.0/test.pony create mode 100644 runtimes/ponylang.nix diff --git a/packages/ponylang/0.39.0/build.sh b/packages/ponylang/0.39.0/build.sh deleted file mode 100755 index ec93a10..0000000 --- a/packages/ponylang/0.39.0/build.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -PREFIX=$(realpath $(dirname $0)) - -# get sources - only get the latest copy of the relevant files -git clone -q https://github.com/ponylang/ponyc.git ponyc - -cd ponyc - -# release commit for 0.39.0 -git reset --hard 85d897b978c5082a1f3264a3a9ad479446d73984 - -# updates all submodules recursively along their tracking branches -# i.e. https://github.com/ponylang/ponyc/blob/main/.gitmodules -git submodule update --recursive --init - -# Build the vendored LLVM libraries that are included in the `lib/llvm/src`. -make libs build_flags="-j$(nproc)" -# Configure the CMake build directory. -make configure -# Will build pony and put it in `build/release`. -make build -# Install pony into `$PREFIX`. -make prefix="$PREFIX" install - -cd .. -rm -rf ponyc diff --git a/packages/ponylang/0.39.0/compile b/packages/ponylang/0.39.0/compile deleted file mode 100644 index f00b22c..0000000 --- a/packages/ponylang/0.39.0/compile +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -# Compile pony file(s) -rename 's/$/\.pony/' "$@" # Add .pony extension -ponyc -b out \ No newline at end of file diff --git a/packages/ponylang/0.39.0/environment b/packages/ponylang/0.39.0/environment deleted file mode 100644 index c6ab089..0000000 --- a/packages/ponylang/0.39.0/environment +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -# Put 'export' statements here for environment variables -export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/ponylang/0.39.0/metadata.json b/packages/ponylang/0.39.0/metadata.json deleted file mode 100644 index 5856c39..0000000 --- a/packages/ponylang/0.39.0/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "ponylang", - "version": "0.39.0", - "aliases": ["pony", "ponyc"] -} diff --git a/packages/ponylang/0.39.0/run b/packages/ponylang/0.39.0/run deleted file mode 100644 index 8ac647b..0000000 --- a/packages/ponylang/0.39.0/run +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -# removes the first arg from $@, which is always the filename -shift -# runs the executable with whatever args are left in $@ -./out "$@" \ No newline at end of file diff --git a/packages/ponylang/0.39.0/test.pony b/packages/ponylang/0.39.0/test.pony deleted file mode 100644 index 556516a..0000000 --- a/packages/ponylang/0.39.0/test.pony +++ /dev/null @@ -1,3 +0,0 @@ -actor Main - new create(env: Env) => - env.out.print("OK") diff --git a/runtimes/default.nix b/runtimes/default.nix index 3e2c7d0..869295a 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -25,4 +25,5 @@ args: { "racket" = import ./racket.nix args; "powershell" = import ./powershell.nix args; "prolog" = import ./prolog.nix args; + "ponylang" = import ./ponylang.nix args; } diff --git a/runtimes/ponylang.nix b/runtimes/ponylang.nix new file mode 100644 index 0000000..73fc423 --- /dev/null +++ b/runtimes/ponylang.nix @@ -0,0 +1,37 @@ +{pkgs, piston, ...}: +let + pkg = pkgs.ponyc; +in piston.mkRuntime { + language = "ponylang"; + version = pkg.version; + aliases = [ + "pony" + "ponyc" + ]; + + compile = '' + rename 's/$/.pony/' "$@" # Add .pony extension + ${pkg}/bin/ponyc -b out + ''; + + run = '' + shift + ./out "$@" + ''; + + tests = [ + (piston.mkTest { + files = { + "test.pony" = '' + actor Main + new create(env: Env) => + env.out.print("OK") + ''; + }; + args = []; + stdin = ""; + packages = []; + main = "test.pony"; + }) + ]; +} \ No newline at end of file