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