mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-28 16:42:09 +00:00
52 lines
1.3 KiB
Nix
52 lines
1.3 KiB
Nix
{ stdenv, lib, fetchurl, php }:
|
|
|
|
let
|
|
version = "1.1.0";
|
|
|
|
bin = "bin/wp";
|
|
ini = "etc/php/wp-cli.ini";
|
|
phar = "share/wp-cli/wp-cli.phar";
|
|
|
|
completion = fetchurl {
|
|
url = "https://raw.githubusercontent.com/wp-cli/wp-cli/v${version}/utils/wp-completion.bash";
|
|
sha256 = "15d330x6d3fizrm6ckzmdknqg6wjlx5fr87bmkbd5s6a1ihs0g24";
|
|
};
|
|
|
|
in stdenv.mkDerivation rec {
|
|
name = "wp-cli-${version}";
|
|
|
|
src = fetchurl {
|
|
url = "https://github.com/wp-cli/wp-cli/releases/download/v${version}/${name}.phar";
|
|
sha256 = "08b2lzc8fa9f5xldbdza6x3lg6jsp3wfwpyy187gxqw5pmqp11xc";
|
|
};
|
|
|
|
buildCommand = ''
|
|
mkdir -p $out/bin $out/etc/php
|
|
|
|
cat <<_EOF > $out/${bin}
|
|
#! ${stdenv.shell} -eu
|
|
exec ${lib.getBin php}/bin/php \\
|
|
-c $out/${ini} \\
|
|
-f $out/${phar} "\$@"
|
|
_EOF
|
|
chmod 755 $out/${bin}
|
|
|
|
cat <<_EOF > $out/${ini}
|
|
[Phar]
|
|
phar.readonly = Off
|
|
_EOF
|
|
chmod 644 $out/${ini}
|
|
|
|
install -Dm644 ${src} $out/${phar}
|
|
install -Dm644 ${completion} $out/share/bash-completion/completions/wp
|
|
'';
|
|
|
|
meta = with stdenv.lib; {
|
|
description = "A command line interface for WordPress";
|
|
maintainers = with maintainers; [ peterhoeg ];
|
|
platforms = platforms.all;
|
|
homepage = https://wp-cli.org;
|
|
license = licenses.mit;
|
|
};
|
|
}
|