From 3530a79a571f81851e87a6af23e9e00f01b038c6 Mon Sep 17 00:00:00 2001 From: Dan Vargas Date: Sun, 6 Feb 2022 21:13:11 -0700 Subject: [PATCH] migrate php to nix --- packages/php/8.0.2/build.sh | 20 -------------------- packages/php/8.0.2/environment | 1 - packages/php/8.0.2/metadata.json | 5 ----- packages/php/8.0.2/run | 3 --- packages/php/8.0.2/test.php | 1 - runtimes/default.nix | 1 + runtimes/php.nix | 26 ++++++++++++++++++++++++++ 7 files changed, 27 insertions(+), 30 deletions(-) delete mode 100755 packages/php/8.0.2/build.sh delete mode 100644 packages/php/8.0.2/environment delete mode 100644 packages/php/8.0.2/metadata.json delete mode 100644 packages/php/8.0.2/run delete mode 100644 packages/php/8.0.2/test.php create mode 100644 runtimes/php.nix diff --git a/packages/php/8.0.2/build.sh b/packages/php/8.0.2/build.sh deleted file mode 100755 index b84a80d..0000000 --- a/packages/php/8.0.2/build.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -PREFIX=$(realpath $(dirname $0)) - -mkdir -p build/php -cd build - -curl "https://www.php.net/distributions/php-8.0.2.tar.gz" -o php.tar.gz -tar xzf php.tar.gz --strip-components=1 -C php - -cd php - - -./configure --prefix "$PREFIX" - -make -j$(nproc) -make install -j$(nproc) - -cd ../../ -rm -rf build diff --git a/packages/php/8.0.2/environment b/packages/php/8.0.2/environment deleted file mode 100644 index bd0ff98..0000000 --- a/packages/php/8.0.2/environment +++ /dev/null @@ -1 +0,0 @@ -export PATH=$PWD/bin:$PATH \ No newline at end of file diff --git a/packages/php/8.0.2/metadata.json b/packages/php/8.0.2/metadata.json deleted file mode 100644 index 14d3e11..0000000 --- a/packages/php/8.0.2/metadata.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "language": "php", - "version": "8.0.2", - "aliases": ["php8", "html"] -} diff --git a/packages/php/8.0.2/run b/packages/php/8.0.2/run deleted file mode 100644 index 1261d95..0000000 --- a/packages/php/8.0.2/run +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -php "$@" \ No newline at end of file diff --git a/packages/php/8.0.2/test.php b/packages/php/8.0.2/test.php deleted file mode 100644 index a0aba93..0000000 --- a/packages/php/8.0.2/test.php +++ /dev/null @@ -1 +0,0 @@ -OK \ No newline at end of file diff --git a/runtimes/default.nix b/runtimes/default.nix index 869295a..910bc8d 100644 --- a/runtimes/default.nix +++ b/runtimes/default.nix @@ -26,4 +26,5 @@ args: { "powershell" = import ./powershell.nix args; "prolog" = import ./prolog.nix args; "ponylang" = import ./ponylang.nix args; + "php" = import ./php.nix args; } diff --git a/runtimes/php.nix b/runtimes/php.nix new file mode 100644 index 0000000..8871f9c --- /dev/null +++ b/runtimes/php.nix @@ -0,0 +1,26 @@ +{pkgs, piston, ...}: +let + pkg = pkgs.php; +in piston.mkRuntime { + language = "php"; + version = pkg.version; + aliases = []; + + run = '' + ${pkg}/bin/php "$@" + ''; + + tests = [ + (piston.mkTest { + files = { + "test.php" = '' + OK + ''; + }; + args = []; + stdin = ""; + packages = []; + main = "test.php"; + }) + ]; +} \ No newline at end of file