clever-tools: rely on bundled package generated through the build script

This commit is contained in:
Florian Sanders 2024-10-26 18:32:06 +02:00
parent cd4ebf6c81
commit d8b13b8f8b
No known key found for this signature in database
GPG Key ID: E94DAA3CD0C7151B

View File

@ -4,6 +4,7 @@
fetchFromGitHub, fetchFromGitHub,
nodejs_18, nodejs_18,
installShellFiles, installShellFiles,
makeWrapper,
stdenv, stdenv,
}: }:
@ -23,22 +24,27 @@ buildNpmPackage rec {
npmDepsHash = "sha256-+3/zSsO5+s1MUome3CQ1p1tN3OtWp+XE9Z6GSdDiRh8="; npmDepsHash = "sha256-+3/zSsO5+s1MUome3CQ1p1tN3OtWp+XE9Z6GSdDiRh8=";
dontNpmBuild = true; nativeBuildInputs = [
installShellFiles
makeWrapper
];
nativeBuildInputs = [ installShellFiles ]; installPhase = ''
mkdir -p $out/bin $out/lib/clever-tools
cp build/clever.cjs $out/lib/clever-tools/clever.cjs
makeWrapperArgs = [ "--set NO_UPDATE_NOTIFIER true" ]; makeWrapper ${nodejs}/bin/node $out/bin/clever \
--add-flags "$out/lib/clever-tools/clever.cjs" \
--set NO_UPDATE_NOTIFIER true
postInstall = runHook postInstall
lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' '';
installShellCompletion --cmd clever \
--bash <($out/bin/clever --bash-autocomplete-script $out/bin/clever) \ postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
--zsh <($out/bin/clever --zsh-autocomplete-script $out/bin/clever) installShellCompletion --cmd clever \
'' --bash <($out/bin/clever --bash-autocomplete-script $out/bin/clever) \
+ '' --zsh <($out/bin/clever --zsh-autocomplete-script $out/bin/clever)
rm $out/bin/install-clever-completion '';
rm $out/bin/uninstall-clever-completion
'';
meta = with lib; { meta = with lib; {
homepage = "https://github.com/CleverCloud/clever-tools"; homepage = "https://github.com/CleverCloud/clever-tools";