2017-01-23 04:35:07 +00:00
|
|
|
{ stdenv, lib, 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
|
|
|
|
2017-01-23 04:35:07 +00:00
|
|
|
bin = "bin/wp";
|
|
|
|
ini = "etc/php/wp-cli.ini";
|
|
|
|
phar = "share/wp-cli/wp-cli.phar";
|
2016-05-22 09:51:48 +01:00
|
|
|
|
2017-01-23 04:35:07 +00:00
|
|
|
completion = fetchurl {
|
|
|
|
url = "https://raw.githubusercontent.com/wp-cli/wp-cli/v${version}/utils/wp-completion.bash";
|
|
|
|
sha256 = "15d330x6d3fizrm6ckzmdknqg6wjlx5fr87bmkbd5s6a1ihs0g24";
|
|
|
|
};
|
|
|
|
|
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "wp-cli-${version}";
|
2016-05-22 09:51:48 +01:00
|
|
|
|
|
|
|
src = fetchurl {
|
2017-01-23 04:35:07 +00:00
|
|
|
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
|
|
|
};
|
|
|
|
|
2017-01-23 04:35:07 +00:00
|
|
|
buildCommand = ''
|
|
|
|
mkdir -p $out/bin $out/etc/php
|
2016-09-13 11:20:51 +01:00
|
|
|
|
2017-01-23 04:35:07 +00:00
|
|
|
cat <<_EOF > $out/${bin}
|
|
|
|
#! ${stdenv.shell} -eu
|
|
|
|
exec ${lib.getBin php}/bin/php \\
|
|
|
|
-c $out/${ini} \\
|
|
|
|
-f $out/${phar} "\$@"
|
|
|
|
_EOF
|
|
|
|
chmod 755 $out/${bin}
|
2016-05-22 09:51:48 +01:00
|
|
|
|
2017-01-23 04:35:07 +00:00
|
|
|
cat <<_EOF > $out/${ini}
|
|
|
|
[Phar]
|
|
|
|
phar.readonly = Off
|
|
|
|
_EOF
|
|
|
|
chmod 644 $out/${ini}
|
|
|
|
|
|
|
|
install -Dm644 ${src} $out/${phar}
|
|
|
|
install -Dm644 ${completion} $out/share/bash-completion/completions/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
|
|
|
};
|
|
|
|
}
|