Files

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

64 lines
1.6 KiB
Nix
Raw Permalink Normal View History

2025-10-09 14:15:47 +02:00
{
lib,
buildNpmPackage,
fetchFromGitHub,
nodejs_22,
installShellFiles,
makeWrapper,
stdenv,
}:
buildNpmPackage rec {
pname = "clever-tools";
version = "4.1.0";
nodejs = nodejs_22;
src = fetchFromGitHub {
owner = "CleverCloud";
repo = "clever-tools";
rev = version;
hash = "sha256-ntKxMlRBE0WoaO2Fmpymhm7y7kCwe197sotNzpK92C4=";
};
npmDepsHash = "sha256-GsJlrz41q9GvFpYZcauuGXgMCG6mqSuI5gy+hxlJfUQ=";
nativeBuildInputs = [
installShellFiles
makeWrapper
];
buildPhase = ''
runHook preBuild
node scripts/bundle-cjs.js ${version} false
runHook postBuild
'';
installPhase = ''
mkdir -p $out/bin $out/lib/clever-tools
cp build/${version}/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 = {
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 = lib.licenses.asl20;
mainProgram = "clever";
teams = [ lib.teams.clevercloud ];
};
}