2019-06-18 14:36:02 +01:00
|
|
|
{ stdenv, lib, fetchurl, writeText, php, makeWrapper }:
|
2016-05-22 09:51:48 +01:00
|
|
|
|
|
|
|
let
|
2019-06-18 14:36:02 +01:00
|
|
|
version = "2.2.0";
|
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";
|
|
|
|
};
|
|
|
|
|
2019-06-18 14:36:02 +01:00
|
|
|
ini = writeText "php.ini" ''
|
|
|
|
[PHP]
|
|
|
|
memory_limit = -1 ; no limit as composer uses a lot of memory
|
|
|
|
|
|
|
|
[Phar]
|
|
|
|
phar.readonly = Off
|
|
|
|
'';
|
|
|
|
|
2018-08-10 08:15:22 +01:00
|
|
|
in stdenv.mkDerivation rec {
|
2019-06-18 14:36:02 +01:00
|
|
|
pname = "wp-cli";
|
2018-08-10 08:15:22 +01:00
|
|
|
inherit version;
|
2016-05-22 09:51:48 +01:00
|
|
|
|
2018-08-10 08:15:22 +01:00
|
|
|
src = fetchurl {
|
2019-06-18 14:36:02 +01:00
|
|
|
url = "https://github.com/wp-cli/wp-cli/releases/download/v${version}/${pname}-${version}.phar";
|
|
|
|
sha256 = "0s03jbsjwvkcbyss6rvpgw867hiwvk5p4n1qznkghyzi94j8mvki";
|
2018-08-10 08:15:22 +01:00
|
|
|
};
|
2016-05-22 09:51:48 +01:00
|
|
|
|
2019-06-18 14:36:02 +01:00
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
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
|
|
|
|
2019-06-18 14:36:02 +01:00
|
|
|
install -Dm444 ${src} $dir/wp-cli
|
|
|
|
install -Dm444 ${ini} $dir/php.ini
|
|
|
|
install -Dm444 ${completion} $out/share/bash-completion/completions/wp
|
2018-08-10 08:15:22 +01:00
|
|
|
|
2019-06-18 14:36:02 +01:00
|
|
|
makeWrapper ${lib.getBin php}/bin/php $out/bin/wp \
|
|
|
|
--add-flags "-c $dir/php.ini" \
|
|
|
|
--add-flags "-f $dir/wp-cli"
|
2018-01-13 06:02:11 +00:00
|
|
|
|
|
|
|
# this is a very basic run test
|
2019-06-18 14:36:02 +01:00
|
|
|
$out/bin/wp --info >/dev/null
|
2016-05-22 09:51:48 +01:00
|
|
|
'';
|
|
|
|
|
2019-06-18 14:36:02 +01:00
|
|
|
meta = with 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
|
|
|
};
|
|
|
|
}
|