blob: a4ac97c9264f5b8a8767ab55d39583a413774315 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
{ stdenv
, lib
, fetchurl
, formats
, installShellFiles
, makeWrapper
, php
}:
let
version = "2.6.0";
completion = fetchurl {
url = "https://raw.githubusercontent.com/wp-cli/wp-cli/v${version}/utils/wp-completion.bash";
hash = "sha256-RDygYQzK6NLWrOug7EqnkpuH7Wz1T2Zq/tGNZjoYo5U=";
};
ini = (formats.ini { }).generate "php.ini" {
PHP.memory_limit = -1; # no limit as composer uses a lot of memory
Phar."phar.readonly" = "Off";
};
in
stdenv.mkDerivation rec {
pname = "wp-cli";
inherit version;
src = fetchurl {
url = "https://github.com/wp-cli/wp-cli/releases/download/v${version}/${pname}-${version}.phar";
hash = "sha256-0WZSjKtgvIIpwGcp5wc4OPu6aNaytXRQTLAniDXIeIg=";
};
nativeBuildInputs = [ installShellFiles makeWrapper ];
buildCommand = ''
dir=$out/share/wp-cli
install -Dm444 ${src} $dir/wp-cli
install -Dm444 ${ini} $dir/php.ini
installShellCompletion --bash --name wp ${completion}
mkdir -p $out/bin
makeWrapper ${lib.getBin php}/bin/php $out/bin/wp \
--add-flags "-c $dir/php.ini" \
--add-flags "-f $dir/wp-cli" \
--add-flags "--"
# this is a very basic run test
$out/bin/wp --info >/dev/null
'';
meta = with lib; {
description = "A command line interface for WordPress";
homepage = "https://wp-cli.org";
license = licenses.mit;
maintainers = with maintainers; [ peterhoeg ];
platforms = platforms.all;
mainProgram = "wp";
};
}
|