at 23.05-pre 51 lines 1.6 kB view raw
1{ stdenv, fetchurl, makeWrapper, writeShellScript, lib, php, curl, jq, common-updater-scripts }: 2 3let 4 pname = "platformsh"; 5 version = "3.79.2"; 6in 7stdenv.mkDerivation { 8 inherit pname version; 9 10 src = fetchurl { 11 url = "https://github.com/platformsh/platformsh-cli/releases/download/v${version}/platform.phar"; 12 sha256 = "sha256-STGMKWgI4C6ccg8DGUhdnEENOB2//gtpU0ljM4cQCXI="; 13 }; 14 15 dontUnpack = true; 16 17 nativeBuildInputs = [ makeWrapper ]; 18 19 installPhase = '' 20 runHook preInstall 21 mkdir -p $out/bin 22 install -D $src $out/libexec/platformsh/platform.phar 23 makeWrapper ${php}/bin/php $out/bin/platform \ 24 --add-flags "$out/libexec/platformsh/platform.phar" 25 runHook postInstall 26 ''; 27 28 passthru = { 29 updateScript = writeShellScript "update-${pname}" '' 30 set -o errexit 31 export PATH="${lib.makeBinPath [ curl jq common-updater-scripts ]}" 32 NEW_VERSION=$(curl -s https://api.github.com/repos/platformsh/platformsh-cli/releases/latest | jq .tag_name --raw-output) 33 34 if [[ "v${version}" = "$NEW_VERSION" ]]; then 35 echo "The new version same as the old version." 36 exit 0 37 fi 38 39 update-source-version "platformsh" "$NEW_VERSION" 40 ''; 41 }; 42 43 meta = with lib; { 44 description = "The unified tool for managing your Platform.sh services from the command line."; 45 homepage = "https://github.com/platformsh/platformsh-cli"; 46 license = licenses.mit; 47 maintainers = with maintainers; [ shyim ]; 48 mainProgram = "platform"; 49 platforms = platforms.all; 50 }; 51}