at 17.09-beta 1.2 kB view raw
1{ stdenv, lib, fetchurl, writeScript, writeText, php }: 2 3let 4 name = "wp-cli-${version}"; 5 version = "1.3.0"; 6 7 src = fetchurl { 8 url = "https://github.com/wp-cli/wp-cli/releases/download/v${version}/${name}.phar"; 9 sha256 = "0q5d32jq7a6rba77sr1yyj6ib6x838hw14mm186ah1xxgnn7rnry"; 10 }; 11 12 completion = fetchurl { 13 url = "https://raw.githubusercontent.com/wp-cli/wp-cli/v${version}/utils/wp-completion.bash"; 14 sha256 = "15d330x6d3fizrm6ckzmdknqg6wjlx5fr87bmkbd5s6a1ihs0g24"; 15 }; 16 17 bin = writeScript "wp" '' 18 #! ${stdenv.shell} 19 20 set -euo pipefail 21 22 exec ${lib.getBin php}/bin/php \ 23 -c ${ini} \ 24 -f ${src} -- "$@" 25 ''; 26 27 ini = writeText "wp-cli.ini" '' 28 [Phar] 29 phar.readonly = Off 30 ''; 31 32in stdenv.mkDerivation rec { 33 inherit name version; 34 35 buildCommand = '' 36 mkdir -p $out/{bin,share/bash-completion/completions} 37 38 ln -s ${bin} $out/bin/wp 39 install -Dm644 ${completion} $out/share/bash-completion/completions/wp 40 ''; 41 42 meta = with stdenv.lib; { 43 description = "A command line interface for WordPress"; 44 homepage = https://wp-cli.org; 45 license = licenses.mit; 46 maintainers = with maintainers; [ peterhoeg ]; 47 platforms = platforms.all; 48 }; 49}