From 97dceb1d654d8b9c4797c146ae4164b5d19eae2c Mon Sep 17 00:00:00 2001 From: Hunter Haugen Date: Fri, 6 Feb 2026 15:19:17 -0800 Subject: [PATCH] forkbump codex to 0.98.0 --- hosts/liminal/configuration.nix | 2 +- hosts/liminal/flake.nix | 6 +- hosts/liminal/pkgs/codex/package.nix | 108 +++++++++++++++++++++++++++ 3 files changed, 114 insertions(+), 2 deletions(-) create mode 100644 hosts/liminal/pkgs/codex/package.nix diff --git a/hosts/liminal/configuration.nix b/hosts/liminal/configuration.nix index da98ef7..e29697e 100644 --- a/hosts/liminal/configuration.nix +++ b/hosts/liminal/configuration.nix @@ -266,7 +266,7 @@ #ruff # for zed goose-cli claude-code - pkgs.unstable.codex + codex neofetch eww quickshell diff --git a/hosts/liminal/flake.nix b/hosts/liminal/flake.nix index 0529f6a..707f1e5 100644 --- a/hosts/liminal/flake.nix +++ b/hosts/liminal/flake.nix @@ -41,6 +41,10 @@ config.allowUnfree = true; }; }; + + overlay-local = final: prev: { + codex = prev.callPackage ./pkgs/codex/package.nix { }; + }; in { nixosConfigurations.liminal = nixpkgs.lib.nixosSystem { @@ -52,7 +56,7 @@ modules = [ # Add unstable overlay - ({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable ]; }) + ({ config, pkgs, ... }: { nixpkgs.overlays = [ overlay-unstable overlay-local ]; }) # Add sops sops-nix.nixosModules.sops diff --git a/hosts/liminal/pkgs/codex/package.nix b/hosts/liminal/pkgs/codex/package.nix new file mode 100644 index 0000000..5c778be --- /dev/null +++ b/hosts/liminal/pkgs/codex/package.nix @@ -0,0 +1,108 @@ +{ + lib, + stdenv, + rustPlatform, + fetchFromGitHub, + installShellFiles, + clang, + cmake, + gitMinimal, + libclang, + makeBinaryWrapper, + nix-update-script, + pkg-config, + openssl, + ripgrep, + versionCheckHook, + installShellCompletions ? stdenv.buildPlatform.canExecute stdenv.hostPlatform, +}: +rustPlatform.buildRustPackage (finalAttrs: { + pname = "codex"; + version = "0.98.0"; + + src = fetchFromGitHub { + owner = "openai"; + repo = "codex"; + tag = "rust-v${finalAttrs.version}"; + hash = "sha256-rP5Qo70n5lNrdR6ycE63VObLwcMNRlk8sY/kuJ4Qw9Y="; + }; + + sourceRoot = "${finalAttrs.src.name}/codex-rs"; + + cargoHash = "sha256-DTLC+s9OfWXkjK2Ab5RKPxRB5SfWNqDLA38jvcraZvg="; + + nativeBuildInputs = [ + clang + cmake + gitMinimal + installShellFiles + makeBinaryWrapper + pkg-config + ]; + + buildInputs = [ + libclang + openssl + ]; + + # NOTE: set LIBCLANG_PATH so bindgen can locate libclang, and adjust + # warning-as-error flags to avoid known false positives (GCC's + # stringop-overflow in BoringSSL's a_bitstr.cc) while keeping Clang's + # character-conversion warning-as-error disabled. + env = { + LIBCLANG_PATH = "${lib.getLib libclang}/lib"; + NIX_CFLAGS_COMPILE = toString ( + lib.optionals stdenv.cc.isGNU [ + "-Wno-error=stringop-overflow" + ] + ++ lib.optionals stdenv.cc.isClang [ + "-Wno-error=character-conversion" + ] + ); + }; + + # NOTE: part of the test suite requires access to networking, local shells, + # apple system configuration, etc. since this is a very fast moving target + # (for now), with releases happening every other day, constantly figuring out + # which tests need to be skipped, or finding workarounds, was too burdensome, + # and in practice not adding any real value. this decision may be reversed in + # the future once this software stabilizes. + doCheck = false; + + 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) + ''; + + postFixup = '' + wrapProgram $out/bin/codex --prefix PATH : ${lib.makeBinPath [ ripgrep ]} + ''; + + doInstallCheck = true; + nativeInstallCheckInputs = [ versionCheckHook ]; + + passthru = { + updateScript = nix-update-script { + extraArgs = [ + "--version-regex" + "^rust-v(\\d+\\.\\d+\\.\\d+)$" + ]; + }; + }; + + meta = { + description = "Lightweight coding agent that runs in your terminal"; + homepage = "https://github.com/openai/codex"; + changelog = "https://raw.githubusercontent.com/openai/codex/refs/tags/rust-v${finalAttrs.version}/CHANGELOG.md"; + license = lib.licenses.asl20; + mainProgram = "codex"; + maintainers = with lib.maintainers; [ + delafthi + jeafleohj + malo + ]; + platforms = lib.platforms.unix; + }; +})