57 lines
1.5 KiB
Nix
57 lines
1.5 KiB
Nix
{
|
|
lib,
|
|
buildNpmPackage,
|
|
fetchFromGitHub,
|
|
nodejs_18,
|
|
installShellFiles,
|
|
makeWrapper,
|
|
stdenv,
|
|
}:
|
|
|
|
buildNpmPackage rec {
|
|
pname = "clever-tools";
|
|
|
|
version = "3.9.0";
|
|
|
|
nodejs = nodejs_18;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "CleverCloud";
|
|
repo = "clever-tools";
|
|
rev = version;
|
|
hash = "sha256-nSTcJIZO/CMliAYFUGu/oA+VdtONDPwyj6vCr5Ry6ac=";
|
|
};
|
|
|
|
npmDepsHash = "sha256-+3/zSsO5+s1MUome3CQ1p1tN3OtWp+XE9Z6GSdDiRh8=";
|
|
|
|
nativeBuildInputs = [
|
|
installShellFiles
|
|
makeWrapper
|
|
];
|
|
|
|
installPhase = ''
|
|
mkdir -p $out/bin $out/lib/clever-tools
|
|
cp build/clever.cjs $out/lib/clever-tools/clever.cjs
|
|
|
|
makeWrapper ${nodejs}/bin/node $out/bin/clever \
|
|
--add-flags "$out/lib/clever-tools/clever.cjs" \
|
|
--set NO_UPDATE_NOTIFIER true
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
|
|
installShellCompletion --cmd clever \
|
|
--bash <($out/bin/clever --bash-autocomplete-script $out/bin/clever) \
|
|
--zsh <($out/bin/clever --zsh-autocomplete-script $out/bin/clever)
|
|
'';
|
|
|
|
meta = with lib; {
|
|
homepage = "https://github.com/CleverCloud/clever-tools";
|
|
changelog = "https://github.com/CleverCloud/clever-tools/blob/${version}/CHANGELOG.md";
|
|
description = "Deploy on Clever Cloud and control your applications, add-ons, services from command line";
|
|
license = licenses.asl20;
|
|
mainProgram = "clever";
|
|
maintainers = teams.clevercloud.members;
|
|
};
|
|
}
|