From 201fb1296924abdbeb09d127918a7346e91c9423 Mon Sep 17 00:00:00 2001 From: myul <52401682+mtul0729@users.noreply.github.com> Date: Wed, 27 May 2026 15:27:26 +0800 Subject: [PATCH] feat: install codex shell completions --- package.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/package.nix b/package.nix index 403ff76..b76561f 100644 --- a/package.nix +++ b/package.nix @@ -4,6 +4,7 @@ , nodejs_22 , cacert , makeWrapper +, installShellFiles , gnutar , gzip , openssl @@ -102,7 +103,8 @@ stdenv.mkDerivation rec { dontPatchELF = runtime == "native"; dontStrip = runtime == "native"; - nativeBuildInputs = selected.nativeBuildInputs; + nativeBuildInputs = selected.nativeBuildInputs + ++ lib.optionals (selected.binName == "codex") [ installShellFiles ]; buildInputs = selected.buildInputs; buildPhase = if runtime == "native" then '' @@ -158,6 +160,13 @@ stdenv.mkDerivation rec { runHook postInstall ''; + postInstall = lib.optionalString (selected.binName == "codex") '' + installShellCompletion --cmd codex \ + --bash <("$out/bin/${selected.binName}" completion bash) \ + --fish <("$out/bin/${selected.binName}" completion fish) \ + --zsh <("$out/bin/${selected.binName}" completion zsh) + ''; + meta = with lib; { description = selected.description; homepage = "https://github.com/openai/codex";