2016-09-13 12:20:51 +02:00
|
|
|
{ stdenv, lib, writeText, writeScript, fetchurl, php }:
|
2016-05-22 10:51:48 +02:00
|
|
|
|
|
|
|
let
|
2016-12-04 14:45:42 +01:00
|
|
|
version = "1.0.0";
|
2016-09-13 12:20:51 +02:00
|
|
|
name = "wp-cli-${version}";
|
|
|
|
|
2016-05-22 10:51:48 +02:00
|
|
|
phpIni = writeText "wp-cli-php.ini" ''
|
|
|
|
[Phar]
|
|
|
|
phar.readonly = Off
|
|
|
|
'';
|
|
|
|
|
2016-09-13 12:20:51 +02:00
|
|
|
wpBin = writeScript "wp" ''
|
|
|
|
#! ${stdenv.shell} -e
|
|
|
|
exec ${php}/bin/php \
|
|
|
|
-c ${phpIni} \
|
|
|
|
-f ${src} "$@"
|
|
|
|
'';
|
2016-05-22 10:51:48 +02:00
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/wp-cli/wp-cli/releases/download/v${version}/${name}.phar";
|
2016-12-04 14:45:42 +01:00
|
|
|
sha256 = "06a80fz9na9arjdpmnislwr0121kkg11kxfqmac0axa9vkv9fjcp";
|
2016-05-22 10:51:48 +02:00
|
|
|
};
|
|
|
|
|
2016-09-13 12:20:51 +02:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
|
2016-12-04 14:45:42 +01:00
|
|
|
inherit name src;
|
2016-05-22 10:51:48 +02:00
|
|
|
|
|
|
|
buildCommand = ''
|
|
|
|
mkdir -p $out/bin
|
2016-09-13 12:20:51 +02:00
|
|
|
ln -s ${wpBin} $out/bin/wp
|
2016-05-22 10:51:48 +02:00
|
|
|
'';
|
|
|
|
|
2016-09-13 12:20:51 +02:00
|
|
|
meta = with stdenv.lib; {
|
2016-05-22 10:51:48 +02:00
|
|
|
description = "A command line interface for WordPress";
|
2016-09-13 12:20:51 +02:00
|
|
|
maintainers = with maintainers; [ peterhoeg ];
|
|
|
|
platforms = platforms.all;
|
2016-05-22 10:51:48 +02:00
|
|
|
homepage = https://wp-cli.org;
|
2016-09-13 12:20:51 +02:00
|
|
|
license = licenses.mit;
|
2016-05-22 10:51:48 +02:00
|
|
|
};
|
|
|
|
}
|