From 0818337430c2d71dd5025fe044d34ad1bb6e73ba Mon Sep 17 00:00:00 2001 From: Malo Bourgon Date: Wed, 30 Apr 2025 14:59:00 -0700 Subject: [PATCH] codex: add shell completions --- pkgs/by-name/co/codex/package.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/by-name/co/codex/package.nix b/pkgs/by-name/co/codex/package.nix index 8f907e478f52..1add11343ffa 100644 --- a/pkgs/by-name/co/codex/package.nix +++ b/pkgs/by-name/co/codex/package.nix @@ -5,6 +5,7 @@ nodejs_22, # Node ≥22 is required by codex-cli pnpm_10, makeBinaryWrapper, + installShellFiles, versionCheckHook, }: @@ -25,6 +26,7 @@ stdenv.mkDerivation (finalAttrs: { nodejs_22 pnpm_10.configHook makeBinaryWrapper + installShellFiles ]; pnpmDeps = pnpm_10.fetchDeps { @@ -54,6 +56,14 @@ stdenv.mkDerivation (finalAttrs: { mkdir -p $out/bin makeBinaryWrapper ${nodejs_22}/bin/node $out/bin/codex --add-flags "$dest/bin/codex.js" + # Install shell completions + ${lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' + $out/bin/codex completion bash > codex.bash + $out/bin/codex completion zsh > codex.zsh + $out/bin/codex completion fish > codex.fish + installShellCompletion codex.{bash,zsh,fish} + ''} + runHook postInstall '';