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