2022-01-28 05:45:56 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchurl
|
|
|
|
, formats
|
|
|
|
, installShellFiles
|
|
|
|
, makeWrapper
|
|
|
|
, php
|
|
|
|
}:
|
|
|
|
|
2016-05-22 08:51:48 +00:00
|
|
|
let
|
2022-01-28 05:45:56 +00:00
|
|
|
version = "2.6.0";
|
2016-09-13 10:20:51 +00:00
|
|
|
|
2017-01-23 04:35:07 +00:00
|
|
|
completion = fetchurl {
|
2020-04-02 08:33:25 +00:00
|
|
|
url = "https://raw.githubusercontent.com/wp-cli/wp-cli/v${version}/utils/wp-completion.bash";
|
2022-01-28 05:45:56 +00:00
|
|
|
hash = "sha256-RDygYQzK6NLWrOug7EqnkpuH7Wz1T2Zq/tGNZjoYo5U=";
|
2017-01-23 04:35:07 +00:00
|
|
|
};
|
|
|
|
|
2022-01-28 05:45:56 +00:00
|
|
|
ini = (formats.ini { }).generate "php.ini" {
|
|
|
|
PHP.memory_limit = -1; # no limit as composer uses a lot of memory
|
|
|
|
Phar."phar.readonly" = "Off";
|
|
|
|
};
|
2019-06-18 13:36:02 +00:00
|
|
|
|
2020-04-02 08:33:25 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2019-06-18 13:36:02 +00:00
|
|
|
pname = "wp-cli";
|
2018-08-10 07:15:22 +00:00
|
|
|
inherit version;
|
2016-05-22 08:51:48 +00:00
|
|
|
|
2018-08-10 07:15:22 +00:00
|
|
|
src = fetchurl {
|
2020-04-02 08:33:25 +00:00
|
|
|
url = "https://github.com/wp-cli/wp-cli/releases/download/v${version}/${pname}-${version}.phar";
|
2022-01-28 05:45:56 +00:00
|
|
|
hash = "sha256-0WZSjKtgvIIpwGcp5wc4OPu6aNaytXRQTLAniDXIeIg=";
|
2018-08-10 07:15:22 +00:00
|
|
|
};
|
2016-05-22 08:51:48 +00:00
|
|
|
|
2022-01-28 05:45:56 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles makeWrapper ];
|
2019-06-18 13:36:02 +00:00
|
|
|
|
2018-08-10 07:15:22 +00:00
|
|
|
buildCommand = ''
|
|
|
|
dir=$out/share/wp-cli
|
2019-06-18 13:36:02 +00:00
|
|
|
install -Dm444 ${src} $dir/wp-cli
|
|
|
|
install -Dm444 ${ini} $dir/php.ini
|
2022-01-28 05:45:56 +00:00
|
|
|
installShellCompletion --bash --name wp ${completion}
|
2018-08-10 07:15:22 +00:00
|
|
|
|
2022-01-28 05:45:56 +00:00
|
|
|
mkdir -p $out/bin
|
2019-06-18 13:36:02 +00:00
|
|
|
makeWrapper ${lib.getBin php}/bin/php $out/bin/wp \
|
|
|
|
--add-flags "-c $dir/php.ini" \
|
2022-03-21 07:15:37 +00:00
|
|
|
--add-flags "-f $dir/wp-cli" \
|
|
|
|
--add-flags "--"
|
2018-01-13 06:02:11 +00:00
|
|
|
|
|
|
|
# this is a very basic run test
|
2019-06-18 13:36:02 +00:00
|
|
|
$out/bin/wp --info >/dev/null
|
2016-05-22 08:51:48 +00:00
|
|
|
'';
|
|
|
|
|
2019-06-18 13:36:02 +00:00
|
|
|
meta = with lib; {
|
2016-05-22 08:51:48 +00:00
|
|
|
description = "A command line interface for WordPress";
|
2020-04-02 08:33:25 +00:00
|
|
|
homepage = "https://wp-cli.org";
|
|
|
|
license = licenses.mit;
|
2016-09-13 10:20:51 +00:00
|
|
|
maintainers = with maintainers; [ peterhoeg ];
|
2020-04-02 08:33:25 +00:00
|
|
|
platforms = platforms.all;
|
2022-03-30 19:33:31 +00:00
|
|
|
mainProgram = "wp";
|
2016-05-22 08:51:48 +00:00
|
|
|
};
|
|
|
|
}
|