2019-06-16 20:59:06 +01:00
|
|
|
{ stdenv, lib, fetchurl, php, runtimeShell }:
|
2016-05-22 09:51:48 +01:00
|
|
|
|
|
|
|
let
|
2018-09-06 14:35:56 +01:00
|
|
|
version = "2.0.1";
|
2016-09-13 11:20:51 +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";
|
|
|
|
};
|
|
|
|
|
2018-08-10 08:15:22 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
|
|
|
name = "wp-cli-${version}";
|
|
|
|
inherit version;
|
2016-05-22 09:51:48 +01:00
|
|
|
|
2018-08-10 08:15:22 +01:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/wp-cli/wp-cli/releases/download/v${version}/${name}.phar";
|
2018-09-06 14:35:56 +01:00
|
|
|
sha256 = "05lbay4c0477465vv4h8d2j94pk3haz1a7f0ncb127fvxz3a2pcg";
|
2018-08-10 08:15:22 +01:00
|
|
|
};
|
2016-05-22 09:51:48 +01:00
|
|
|
|
2018-08-10 08:15:22 +01:00
|
|
|
buildCommand = ''
|
|
|
|
dir=$out/share/wp-cli
|
|
|
|
mkdir -p $out/bin $dir
|
2016-05-22 09:51:48 +01:00
|
|
|
|
2018-08-10 08:15:22 +01:00
|
|
|
cat <<_EOF > $out/bin/wp
|
2019-02-26 11:45:54 +00:00
|
|
|
#!${runtimeShell}
|
2017-12-27 16:34:51 +00:00
|
|
|
|
2018-08-10 08:15:22 +01:00
|
|
|
set -euo pipefail
|
2017-08-16 01:39:22 +01:00
|
|
|
|
2018-08-10 08:15:22 +01:00
|
|
|
exec ${lib.getBin php}/bin/php \\
|
|
|
|
-c $dir/php.ini \\
|
|
|
|
-f $dir/wp-cli -- "\$@"
|
|
|
|
_EOF
|
|
|
|
chmod 0755 $out/bin/wp
|
2017-08-16 01:39:22 +01:00
|
|
|
|
2018-08-10 08:15:22 +01:00
|
|
|
cat <<_EOF > $dir/php.ini
|
|
|
|
[PHP]
|
|
|
|
memory_limit = -1 ; no limit as composer uses a lot of memory
|
|
|
|
|
|
|
|
[Phar]
|
|
|
|
phar.readonly = Off
|
|
|
|
_EOF
|
|
|
|
|
|
|
|
install -Dm644 ${src} $dir/wp-cli
|
2017-01-23 04:35:07 +00:00
|
|
|
install -Dm644 ${completion} $out/share/bash-completion/completions/wp
|
2018-01-13 06:02:11 +00:00
|
|
|
|
|
|
|
# this is a very basic run test
|
|
|
|
$out/bin/wp --info
|
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";
|
2017-08-16 01:39:22 +01:00
|
|
|
homepage = https://wp-cli.org;
|
|
|
|
license = licenses.mit;
|
2016-09-13 11:20:51 +01:00
|
|
|
maintainers = with maintainers; [ peterhoeg ];
|
2017-08-16 01:39:22 +01:00
|
|
|
platforms = platforms.all;
|
2016-05-22 09:51:48 +01:00
|
|
|
};
|
|
|
|
}
|