phpactor: init at 2023.01.21

Initialized as a fixed output derivation because composer needs to
access the internet to download dependencies. I've tested the
reproducibility of it following my steps here:

https://discourse.nixos.org/t/reproducibility-checking-with-new-cli-and-fixed-output-derivations/27053

composer2nix didn't work for this package and it seemed simpler to do this.
This commit is contained in:
Ryan Mulligan 2023-04-06 14:32:17 -07:00
parent 1a14c8d6b1
commit 3fdb0346d7
2 changed files with 80 additions and 0 deletions

View file

@ -0,0 +1,79 @@
{ lib, stdenvNoCC, fetchFromGitHub, php, phpPackages }:
let
version = "2023.01.21";
src = fetchFromGitHub {
owner = "phpactor";
repo = "phpactor";
rev = version;
hash = "sha256-jWZgBEaffjQ5wCStSEe+eIi7BJt6XAQFEjmq5wvW5V8=";
};
vendor = stdenvNoCC.mkDerivation rec {
pname = "phpactor-vendor";
inherit src version;
# See https://github.com/NixOS/nix/issues/6660
dontPatchShebangs = true;
nativeBuildInputs = [
php
phpPackages.composer
];
buildPhase = ''
runHook preBuild
substituteInPlace composer.json \
--replace '"config": {' '"config": { "autoloader-suffix": "Phpactor",' \
--replace '"name": "phpactor/phpactor",' '"name": "phpactor/phpactor", "version": "${version}",'
composer install --no-interaction --optimize-autoloader --no-dev --no-scripts
runHook postBuild
'';
installPhase = ''
runHook preInstall
mkdir -p $out
cp -ar ./vendor $out/
runHook postInstall
'';
outputHashMode = "recursive";
outputHashAlgo = "sha256";
outputHash = "sha256-7R6nadWFv7A5Hv14D9egsTD/zcKK5uK9LQlHmwtbKdE=";
};
in
stdenvNoCC.mkDerivation {
pname = "phpactor";
inherit src version;
buildInputs = [
php
];
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir -p $out/share/php/phpactor $out/bin
cp -r . $out/share/php/phpactor
cp -r ${vendor}/vendor $out/share/php/phpactor
ln -s $out/share/php/phpactor/bin/phpactor $out/bin/phpactor
runHook postInstall
'';
meta = {
description = "Mainly a PHP Language Server";
homepage = "https://github.com/phpactor/phpactor";
license = lib.licenses.mit;
maintainers = lib.teams.php.members ++ [ lib.maintainers.ryantm ];
};
}

View file

@ -16755,6 +16755,7 @@ with pkgs;
php80Extensions = recurseIntoAttrs php80.extensions;
php80Packages = recurseIntoAttrs php80.packages;
phpactor = callPackage ../development/tools/phpactor { };
picoc = callPackage ../development/interpreters/picoc { };