From a8adca3e18af0dbe8c35f5b8208e16a42373c4a3 Mon Sep 17 00:00:00 2001 From: Dan Vargas Date: Sun, 6 Feb 2022 20:55:36 -0700 Subject: [PATCH] move prolog to nix --- packages/prolog/8.2.4/build.sh | 22 ---------------------- packages/prolog/8.2.4/environment | 1 - packages/prolog/8.2.4/metadata.json | 5 ----- packages/prolog/8.2.4/run | 4 ---- packages/prolog/8.2.4/test.prolog | 1 - runtimes/default.nix | 1 + runtimes/prolog.nix | 29 +++++++++++++++++++++++++++++ 7 files changed, 30 insertions(+), 33 deletions(-) delete mode 100755 packages/prolog/8.2.4/build.sh delete mode 100644 packages/prolog/8.2.4/environment delete mode 100644 packages/prolog/8.2.4/metadata.json delete mode 100644 packages/prolog/8.2.4/run delete mode 100644 packages/prolog/8.2.4/test.prolog create mode 100644 runtimes/prolog.nix diff --git a/packages/prolog/8.2.4/build.sh b/packages/prolog/8.2.4/build.sh deleted file mode 100755 index 3473d69..0000000 --- a/packages/prolog/8.2.4/build.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -PREFIX=$(realpath $(dirname $0)) - -mkdir -p build - -cd build - -# Source compile -curl -L "https://www.swi-prolog.org/download/stable/src/swipl-8.2.4.tar.gz" -o swipl.tar.gz -tar xzf swipl.tar.gz --strip-components=1 -rm swipl.tar.gz - -mkdir build -cd build -cmake -DCMAKE_INSTALL_PREFIX="$PREFIX" -DSWIPL_PACKAGES_JAVA=OFF -DSWIPL_PACKAGES_X=OFF -DMULTI_THREADED=OFF -DINSTALL_DOCUMENTATION=OFF .. -make -j$(nproc) -make install -j$(nproc) - -cd ../../ - -rm -rf build diff --git a/packages/prolog/8.2.4/environment b/packages/prolog/8.2.4/environment deleted file mode 100644 index bd0ff98..0000000 --- a/packages/prolog/8.2.4/environment +++ /dev/null @@ -1 +0,0 @@ -export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/prolog/8.2.4/metadata.json b/packages/prolog/8.2.4/metadata.json deleted file mode 100644 index d799d87..0000000 --- a/packages/prolog/8.2.4/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "prolog", - "version": "8.2.4", - "aliases": ["prolog", "plg"] -} diff --git a/packages/prolog/8.2.4/run b/packages/prolog/8.2.4/run deleted file mode 100644 index 7609191..0000000 --- a/packages/prolog/8.2.4/run +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -# Put instructions to run the runtime -swipl -g true -t halt "$@" diff --git a/packages/prolog/8.2.4/test.prolog b/packages/prolog/8.2.4/test.prolog deleted file mode 100644 index 290ef7c..0000000 --- a/packages/prolog/8.2.4/test.prolog +++ /dev/null @@ -1 +0,0 @@ -:- write('OK'), nl. \ No newline at end of file diff --git a/runtimes/default.nix b/runtimes/default.nix index 3dc95a5..3e2c7d0 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -24,4 +24,5 @@ args: { "raku" = import ./raku.nix args; "racket" = import ./racket.nix args; "powershell" = import ./powershell.nix args; + "prolog" = import ./prolog.nix args; } diff --git a/runtimes/prolog.nix b/runtimes/prolog.nix new file mode 100644 index 0000000..a4058e1 --- /dev/null +++ b/runtimes/prolog.nix @@ -0,0 +1,29 @@ +{pkgs, piston, ...}: +let + pkg = pkgs.swiProlog; +in piston.mkRuntime { + language = "prolog"; + version = pkg.version; + + aliases = [ + "plg" + ]; + + run = '' + ${pkg}/bin/swipl -g true -t halt "$@" + ''; + + tests = [ + (piston.mkTest { + files = { + "test.pl" = '' + :- write('OK'), nl. + ''; + }; + args = []; + stdin = ""; + packages = []; + main = "test.pl"; + }) + ]; +} \ No newline at end of file