nixpkgs/pkgs/development/tools/wp-cli/default.nix

41 lines
878 B
Nix
Raw Normal View History

2016-09-13 12:20:51 +02:00
{ stdenv, lib, writeText, writeScript, fetchurl, php }:
2016-05-22 10:51:48 +02:00
let
2016-09-13 12:20:51 +02:00
version = "0.24.1";
name = "wp-cli-${version}";
2016-05-22 10:51:48 +02:00
phpIni = writeText "wp-cli-php.ini" ''
[Phar]
phar.readonly = Off
'';
2016-09-13 12:20:51 +02:00
wpBin = writeScript "wp" ''
#! ${stdenv.shell} -e
exec ${php}/bin/php \
-c ${phpIni} \
-f ${src} "$@"
'';
2016-05-22 10:51:48 +02:00
src = fetchurl {
url = "https://github.com/wp-cli/wp-cli/releases/download/v${version}/${name}.phar";
2016-09-13 12:20:51 +02:00
sha256 = "027nclp8qbfr624ja6aixzcwnvb55d7dskk9l1i042bc86hmphfd";
2016-05-22 10:51:48 +02:00
};
2016-09-13 12:20:51 +02:00
in stdenv.mkDerivation rec {
inherit name;
2016-05-22 10:51:48 +02:00
buildCommand = ''
mkdir -p $out/bin
2016-09-13 12:20:51 +02:00
ln -s ${wpBin} $out/bin/wp
2016-05-22 10:51:48 +02:00
'';
2016-09-13 12:20:51 +02:00
meta = with stdenv.lib; {
2016-05-22 10:51:48 +02:00
description = "A command line interface for WordPress";
2016-09-13 12:20:51 +02:00
maintainers = with maintainers; [ peterhoeg ];
platforms = platforms.all;
2016-05-22 10:51:48 +02:00
homepage = https://wp-cli.org;
2016-09-13 12:20:51 +02:00
license = licenses.mit;
2016-05-22 10:51:48 +02:00
};
}