Commit b16f4699 authored by Caleb Norton's avatar Caleb Norton
Browse files

openclaw: add shell completions

parent c9ab769c
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
{
  lib,
  stdenvNoCC,
  buildPackages,
  fetchFromGitHub,
  fetchPnpmDeps,
  pnpmConfigHook,
@@ -10,6 +11,7 @@
  versionCheckHook,
  nix-update-script,
  rolldown,
  installShellFiles,
  version ? "2026.3.12",
}:
stdenvNoCC.mkDerivation (finalAttrs: {
@@ -39,6 +41,7 @@ stdenvNoCC.mkDerivation (finalAttrs: {
    pnpm_10
    nodejs_22
    makeWrapper
    installShellFiles
  ];

  preBuild = ''
@@ -82,6 +85,18 @@ stdenvNoCC.mkDerivation (finalAttrs: {
    runHook postInstall
  '';

  postInstall = lib.optionalString (stdenvNoCC.hostPlatform.emulatorAvailable buildPackages) (
    let
      emulator = stdenvNoCC.hostPlatform.emulator buildPackages;
    in
    ''
      installShellCompletion --cmd openclaw \
        --bash <(${emulator} $out/bin/openclaw completion --shell bash) \
        --fish <(${emulator} $out/bin/openclaw completion --shell fish) \
        --zsh <(${emulator} $out/bin/openclaw completion --shell zsh)
    ''
  );

  nativeInstallCheckInputs = [ versionCheckHook ];
  doInstallCheck = true;