2022-04-24 10:28:18 +02:00
|
|
|
{ stdenv, fetchurl, makeWrapper, writeShellScript, lib, php, curl, jq, common-updater-scripts }:
|
|
|
|
|
|
|
|
let
|
|
|
|
pname = "platformsh";
|
2022-05-04 06:20:00 +02:00
|
|
|
version = "3.79.2";
|
2022-04-24 10:28:18 +02:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
inherit pname version;
|
|
|
|
|
|
|
|
src = fetchurl {
|
2022-04-30 02:32:29 +02:00
|
|
|
url = "https://github.com/platformsh/platformsh-cli/releases/download/v${version}/platform.phar";
|
2022-05-04 06:20:00 +02:00
|
|
|
sha256 = "sha256-STGMKWgI4C6ccg8DGUhdnEENOB2//gtpU0ljM4cQCXI=";
|
2022-04-24 10:28:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
dontUnpack = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ makeWrapper ];
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
mkdir -p $out/bin
|
|
|
|
install -D $src $out/libexec/platformsh/platform.phar
|
|
|
|
makeWrapper ${php}/bin/php $out/bin/platform \
|
|
|
|
--add-flags "$out/libexec/platformsh/platform.phar"
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
updateScript = writeShellScript "update-${pname}" ''
|
|
|
|
set -o errexit
|
|
|
|
export PATH="${lib.makeBinPath [ curl jq common-updater-scripts ]}"
|
|
|
|
NEW_VERSION=$(curl -s https://api.github.com/repos/platformsh/platformsh-cli/releases/latest | jq .tag_name --raw-output)
|
|
|
|
|
2022-04-30 02:32:29 +02:00
|
|
|
if [[ "v${version}" = "$NEW_VERSION" ]]; then
|
2022-04-24 10:28:18 +02:00
|
|
|
echo "The new version same as the old version."
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
update-source-version "platformsh" "$NEW_VERSION"
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "The unified tool for managing your Platform.sh services from the command line.";
|
|
|
|
homepage = "https://github.com/platformsh/platformsh-cli";
|
2022-05-05 02:46:39 +02:00
|
|
|
license = licenses.mit;
|
2022-04-24 10:28:18 +02:00
|
|
|
maintainers = with maintainers; [ shyim ];
|
2022-05-05 02:46:39 +02:00
|
|
|
mainProgram = "platform";
|
2022-04-24 10:28:18 +02:00
|
|
|
platforms = platforms.all;
|
|
|
|
};
|
|
|
|
}
|