Nix package for Codex CLI.
Source: openai/codex.
- Nix package:
codex(binary:codex) - Nix app output:
.#codex - Scripted updater for version/source hash pin refresh
- Scheduled GitHub Actions updater that opens auto-mergeable PRs
- Automated GitHub release creation on
codexversion bumps - Local quality gate (
just) and GitHub Actions CI
# list commands
just --list
# full local validation gate
just check
# run the packaged binary
just run --helpnix build -L 'path:.#codex'
nix run 'path:.#codex' -- --helpSuccess criteria:
nix buildexits0nix runprintscodexCLI usage output
# latest stable rust-vX.Y.Z tag from openai/codex
just update
# explicit version forms are accepted
just update 0.104.0
just update v0.104.0
just update rust-v0.104.0./scripts/update-package.sh updates:
versionsrc.hashCargo.lock(from upstreamcodex-rs)
Only full release versions are accepted (X.Y.Z). Pre-release tags (for example
rust-v0.105.0-alpha.1) are ignored/rejected.
curlgitjqnixperltar
Check script usage:
./scripts/update-package.sh --helpWorkflow: .github/workflows/update-codex.yml
- Runs every 6 hours and on manual dispatch.
- Detects the latest stable upstream
rust-vX.Y.Ztag fromopenai/codex. - Ignores pre-release tags (alpha/beta/rc) and rejects non-
X.Y.Zmanual overrides. - If newer than
package.nix, runsscripts/update-package.sh, then runsjust validate-updatebefore opening/updating a PR. just validate-updateperforms lightweight linting plusnix build --dry-run 'path:.#codex'.- Leaves the full
just buildcompile to the normal PR CI workflow. - Enables auto-merge (
squash) for that PR.
- Add repo secret
CODEX_UPDATER_TOKEN(fine-grained PAT scoped to this repo):- Contents: Read and write
- Pull requests: Read and write
- In repository settings → Actions → General:
- Set workflow permissions to Read and write permissions.
- Enable Allow GitHub Actions to create and approve pull requests.
- Ensure branch protection/required checks allow auto-merge after CI passes.
Manual trigger:
- Actions → Update codex package → Run workflow
- Optional input:
version(accepts0.x.y,v0.x.y, orrust-v0.x.y)
Workflow: .github/workflows/release-codex.yml
- Runs on pushes to
mainwhenpackage.nixchanges. - Compares previous and current
package.nixversionvalues. - Creates a GitHub release + tag named
v<version>only when the packaged version changes. - Skips docs-only merges and other changes that do not modify
package.nixversion.
No extra secret is required; it uses the workflow GITHUB_TOKEN with contents: write.
just fmt
just fmt-check
just lint
just checkjust lint runs:
statixdeadnixnixfmt --checkshellcheck
{
inputs.nixCodex.url = "github:rbright/nix-codex";
outputs = { self, nixpkgs, nixCodex, ... }: {
nixosConfigurations.my-host = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
({ pkgs, ... }: {
environment.systemPackages = [
nixCodex.packages.${pkgs.system}.codex
];
})
];
};
};
}