diff --git a/pkgs/by-name/co/codex/package.nix b/pkgs/by-name/co/codex/package.nix index 29c9d8b011fc..0fe7f41b3b9f 100644 --- a/pkgs/by-name/co/codex/package.nix +++ b/pkgs/by-name/co/codex/package.nix @@ -1,39 +1,66 @@ { lib, + stdenv, rustPlatform, fetchFromGitHub, + gitMinimal, + installShellFiles, nix-update-script, pkg-config, + python3, openssl, versionCheckHook, + installShellCompletions ? stdenv.buildPlatform.canExecute stdenv.hostPlatform, }: rustPlatform.buildRustPackage (finalAttrs: { pname = "codex"; - version = "0.4.0"; + version = "0.11.0"; src = fetchFromGitHub { owner = "openai"; repo = "codex"; tag = "rust-v${finalAttrs.version}"; - hash = "sha256-rRe0JFEO5ixxrZYDL8kxXDOH0n7lqabkXNNaSlNnQDg="; + hash = "sha256-t7FgR84alnJGhN/dsFtUySFfOpGoBlRfP+D/Q6JPz5M="; }; sourceRoot = "${finalAttrs.src.name}/codex-rs"; - cargoHash = "sha256-QIZ3V4NUo1VxJN3cwdQf3S0zwePnwdKKfch0jlIJacU="; + cargoHash = "sha256-SNl6UXzvtVR+ep7CIoCcpvET8Hs7ew1fmHqOXbzN7kU="; nativeBuildInputs = [ + installShellFiles pkg-config ]; + buildInputs = [ openssl + python3 # Required because of codex-rs/login/src/login_with_chatgpt.py ]; + nativeCheckInputs = [ gitMinimal ]; + + __darwinAllowLocalNetworking = true; + env = { + CODEX_SANDBOX = "seatbelt"; # Disables sandbox tests which want to access /usr/bin/touch + CODEX_SANDBOX_NETWORK_DISABLED = 1; # Skips tests that require networking + }; checkFlags = [ - "--skip=keeps_previous_response_id_between_tasks" # Requires network access - "--skip=retries_on_early_close" # Requires network access + "--skip=shell::tests::test_run_with_profile_escaping_and_execution" # Wants to access /bin/zsh + "--skip=includes_base_instructions_override_in_request" # Fails with 'stream ended unexpectedly: InternalAgentDied' + "--skip=includes_user_instructions_message_in_request" # Fails with 'stream ended unexpectedly: InternalAgentDied' + "--skip=originator_config_override_is_used" # Fails with 'stream ended unexpectedly: InternalAgentDied' + "--skip=test_conversation_create_and_send_message_ok" # Version 0.0.0 hardcoded + "--skip=test_send_message_session_not_found" # Version 0.0.0 hardcoded + "--skip=test_send_message_success" # Version 0.0.0 hardcoded ]; + postInstall = lib.optionalString installShellCompletions '' + installShellCompletion --cmd codex \ + --bash <($out/bin/codex completion bash) \ + --fish <($out/bin/codex completion fish) \ + --zsh <($out/bin/codex completion zsh) + ''; + doInstallCheck = true; nativeInstallCheckInputs = [ versionCheckHook ];