migrate php to nix

This commit is contained in:
Dan Vargas 2022-02-06 21:13:11 -07:00
parent dc2c5f3380
commit 3530a79a57
7 changed files with 27 additions and 30 deletions

View File

@ -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

View File

@ -1 +0,0 @@
export PATH=$PWD/bin:$PATH

View File

@ -1,5 +0,0 @@
{
"language": "php",
"version": "8.0.2",
"aliases": ["php8", "html"]
}

View File

@ -1,3 +0,0 @@
#!/bin/bash
php "$@"

View File

@ -1 +0,0 @@
OK

View File

@ -26,4 +26,5 @@ args: {
"powershell" = import ./powershell.nix args; "powershell" = import ./powershell.nix args;
"prolog" = import ./prolog.nix args; "prolog" = import ./prolog.nix args;
"ponylang" = import ./ponylang.nix args; "ponylang" = import ./ponylang.nix args;
"php" = import ./php.nix args;
} }

26
runtimes/php.nix Normal file
View File

@ -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";
})
];
}