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