depot/pkgs/by-name/cl/clever-tools/package.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

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;
};
}