Created
April 7, 2023 17:18
-
-
Save drupol/4f15267296f34a8244aa76ed543ab126 to your computer and use it in GitHub Desktop.
phpactor/default.nix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ lib, stdenvNoCC, fetchFromGitHub, php }: | |
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 ]; | |
buildPhase = '' | |
runHook preBuild | |
substituteInPlace composer.json \ | |
--replace '"config": {' '"config": { "autoloader-suffix": "Phpactor",' \ | |
--replace '"name": "phpactor/phpactor",' '"name": "phpactor/phpactor", "version": "${version}",' | |
${php.packages.composer}/bin/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 ]; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment