10 Commits

  • fix(nix): include libcap dependency on linux builds (#12415)
    commit 923f931121 introduced a dependency
    on `libcap`. This PR fixes the nix build by including `libcap` in nix's
    build inputs
    
    issue number: #12102. @etraut-openai gave me permission to open pr 
    
    Testing:
    running `nix run .#codex-rs` works on both macos (aarch64) and nixos
    (x86-64)
  • fix(nix): use correct version from Cargo.toml in flake build (#11770)
    ## Summary
    
    - When building via `nix build`, the binary reports `codex-cli 0.0.0`
    because the workspace `Cargo.toml` uses `0.0.0` as a placeholder on
    `main`. This causes the update checker to always prompt users to upgrade
    even when running the latest code.
    - Reads the version from `codex-rs/Cargo.toml` at flake evaluation time
    using `builtins.fromTOML` and patches it into the workspace `Cargo.toml`
    before cargo builds via `postPatch`.
    - On release commits (e.g. tag `rust-v0.101.0`), the real version is
    used as-is. On `main` branch builds, falls back to
    `0.0.0-dev+<shortRev>` (or `0.0.0-dev+dirty`), which the update
    checker's `parse_version` ignores — suppressing the spurious upgrade
    prompt.
    
    | Scenario | Cargo.toml version | Nix `version` | Binary reports |
    Upgrade nag? |
    |---|---|---|---|---|
    | Release commit (e.g. `rust-v0.101.0`) | `0.101.0` | `0.101.0` |
    `codex-cli 0.101.0` | Only if newer exists |
    | Main branch (committed) | `0.0.0` | `0.0.0-dev+b934ffc` | `codex-cli
    0.0.0-dev+b934ffc` | No |
    | Main branch (uncommitted) | `0.0.0` | `0.0.0-dev+dirty` | `codex-cli
    0.0.0-dev+dirty` | No |
    
    ## Test plan
    
    - [ ] `nix build` from `main` branch and verify `codex --version`
    reports `0.0.0-dev+<shortRev>` instead of `0.0.0`
    - [ ] Verify the update checker does not show a spurious upgrade prompt
    for dev builds
    - [ ] Confirm that on a release commit where `Cargo.toml` has a real
    version, the binary reports that version correctly
  • fix: nix build by adding missing dependencies and fix outputHashes (#11185)
    Fixes #11020
    
    I do think think `nix build` should run in CI, I had multiple issues
    trying to build the flake in the past, as it's continuously out of sync
    with the rest of the repo. (like a few days ago I didn't need the
    updated outputHashes, just the missing packages).
    
    Co-authored-by: Eric Traut <etraut@openai.com>
  • fix(nix): update flake for newer Rust toolchain requirements (#10302)
    ## Summary
    
    - Add rust-overlay input to provide newer Rust versions (rama crates
    require rustc 1.91.0+)
    - Add devShells output with complete development environment
    - Add missing git dependency hashes to codex-rs/default.nix
    
    ## Changes
    
    **flake.nix:**
    - Added `rust-overlay` input to get newer Rust toolchains
    - Updated `packages` output to use `rust-bin.stable.latest.minimal` for
    builds
    - Added `devShells` output with:
      - Rust with `rust-src` and `rust-analyzer` extensions for IDE support
    - Required build dependencies: `pkg-config`, `openssl`, `cmake`,
    `libclang`
      - Environment variables: `PKG_CONFIG_PATH`, `LIBCLANG_PATH`
    
    **codex-rs/default.nix:**
    - Added missing `outputHashes` for git dependencies:
      - `nucleo-0.5.0`, `nucleo-matcher-0.3.1`
      - `runfiles-0.1.0`
      - `tokio-tungstenite-0.28.0`, `tungstenite-0.28.0`
    
    ## Test Plan
    
    - [x] `nix develop` enters shell successfully
    - [x] `nix develop -c rustc --version` shows 1.93.0
    - [x] `nix develop -c cargo build` completes successfully
  • fix: drop stale filedescriptor output hash for nix (#7865)
    Fixes: #7863 
    
    - Remove the `filedescriptor-0.8.3` entry from `codex-rs/default.nix`
    output hashes because the crate now comes from crates.io.
  • Fix Nix cargo output hashes for rmcp and filedescriptor (#7762)
    Fixes #7759:
    
    - Drop the stale `rmcp` entry from `codex-rs/default.nix`’s
    `cargoLock.outputHashes` since the crate now comes from crates.io and no
    longer needs a git hash.
    - Add the missing hash for the filedescriptor-0.8.3 git dependency (from
    `pakrym/wezterm`) so `buildRustPackage` can vendor it.
  • fix: nix build missing rmcp output hash (#7436)
    Output hash for `rmcp-0.9.0` was missing from the nix package, (i.e.
    `error: No hash was found while vendoring the git dependency
    rmcp-0.9.0.`) blocking the build.
  • Fix nix build (#6230)
    Previously, the `nix build .#default` command fails due to a missing
    output hash in the `./codex-rs/default.nix` for `crossterm-0.28.1`:
    
    ```
    error: No hash was found while vendoring the git dependency crossterm-0.28.1. You can add
    a hash through the `outputHashes` argument of `importCargoLock`:
    
    outputHashes = {
     "crossterm-0.28.1" = "<hash>";
    };
    
    If you use `buildRustPackage`, you can add this attribute to the `cargoLock`
    attribute set.
    ```
    
    This PR adds the missing hash:
    
    ```diff
    cargoLock.outputHashes = {
      "ratatui-0.29.0" = "sha256-HBvT5c8GsiCxMffNjJGLmHnvG77A6cqEL+1ARurBXho=";
    + "crossterm-0.28.1" = "sha256-6qCtfSMuXACKFb9ATID39XyFDIEMFDmbx6SSmNe+728=";
    };
    ```
    
    With this change, `nix build .#default` succeeds:
    
    ```
    > nix build .#default --max-jobs 1 --cores 2
    
    warning: Git tree '/home/lukas/r/github.com/lukasl-dev/codex' is dirty
    [1/0/1 built] building codex-rs-0.1.0 (buildPhase)[1/0/1 built] building codex-rs-0.1.0 (buildP[1/0/1 built] building codex-rs-0.1.0 (buildPhase):    [1/0/1 built] building codex-rs-0.1.0 (b[1/0/1 built] building codex-rs-0.1.0 (buildPhase):    Compi[1/0/1 built] building codex-rs-0.1
    
    > ./result/bin/codex
      You are running Codex in /home/lukas/r/github.com/lukasl-dev/codex
    
      Since this folder is version controlled, you may wish to allow Codex to work in this folder without asking for approval.
      ...
    ```
  • Fix nix build (#4048)
    I dropped the build of the old cli from the flake, where the default.nix
    already seemed to removed in a previous iterations. Then I updated
    flake.nix and codex-rs expression to be able to build again (see
    individual commits for details).
    
    Tested by running the following builds:
    
    
    ```
    $ nix build .#packages.x86_64-linux.codex-rs
    $ nix build .#packages.aarch64-darwin.codex-cli
    ```
    
    ---------
    
    Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
  • restructure flake for codex-rs (#888)
    Right now since the repo is having two different implementations of
    codex, flake was updated to work with both typescript implementation and
    rust implementation