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>
This commit is contained in:
Jörg Thalheim
2025-10-17 20:19:08 +01:00
committed by GitHub
parent c03e31ecf5
commit 44ceaf085b
3 changed files with 54 additions and 149 deletions

View File

@@ -1,42 +1,31 @@
{ pkgs, monorep-deps ? [], ... }: {
let openssl,
rustPlatform,
pkg-config,
lib,
...
}:
rustPlatform.buildRustPackage (finalAttrs: {
env = { env = {
PKG_CONFIG_PATH = "${pkgs.openssl.dev}/lib/pkgconfig:$PKG_CONFIG_PATH"; PKG_CONFIG_PATH = "${openssl.dev}/lib/pkgconfig:$PKG_CONFIG_PATH";
}; };
in
rec {
package = pkgs.rustPlatform.buildRustPackage {
inherit env;
pname = "codex-rs"; pname = "codex-rs";
version = "0.1.0"; version = "0.1.0";
cargoLock.lockFile = ./Cargo.lock; cargoLock.lockFile = ./Cargo.lock;
doCheck = false; doCheck = false;
src = ./.; src = ./.;
nativeBuildInputs = with pkgs; [ nativeBuildInputs = [
pkg-config pkg-config
openssl openssl
]; ];
meta = with pkgs.lib; {
cargoLock.outputHashes = {
"ratatui-0.29.0" = "sha256-HBvT5c8GsiCxMffNjJGLmHnvG77A6cqEL+1ARurBXho=";
};
meta = with lib; {
description = "OpenAI Codex commandline interface rust implementation"; description = "OpenAI Codex commandline interface rust implementation";
license = licenses.asl20; license = licenses.asl20;
homepage = "https://github.com/openai/codex"; homepage = "https://github.com/openai/codex";
}; };
}; })
devShell = pkgs.mkShell {
inherit env;
name = "codex-rs-dev";
packages = monorep-deps ++ [
pkgs.cargo
package
];
shellHook = ''
echo "Entering development shell for codex-rs"
alias codex="cd ${package.src}/tui; cargo run; cd -"
${pkgs.rustPlatform.cargoSetupHook}
'';
};
app = {
type = "app";
program = "${package}/bin/codex";
};
}

63
flake.lock generated
View File

@@ -1,30 +1,12 @@
{ {
"nodes": { "nodes": {
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1744463964, "lastModified": 1758427187,
"narHash": "sha256-LWqduOgLHCFxiTNYi3Uj5Lgz0SR+Xhw3kr/3Xd0GPTM=", "narHash": "sha256-pHpxZ/IyCwoTQPtFIAG2QaxuSm8jWzrzBGjwQZIttJc=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "2631b0b7abcea6e640ce31cd78ea58910d31e650", "rev": "554be6495561ff07b6c724047bdd7e0716aa7b46",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -36,44 +18,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-utils": "flake-utils", "nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1746844454,
"narHash": "sha256-GcUWDQUDRYrD34ol90KGUpjbVcOfUNbv0s955jPecko=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "be092436d4c0c303b654e4007453b69c0e33009e",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
} }
} }
}, },

View File

@@ -1,57 +1,28 @@
{ {
description = "Development Nix flake for OpenAI Codex CLI"; description = "Development Nix flake for OpenAI Codex CLI";
inputs = { inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { nixpkgs, flake-utils, rust-overlay, ... }: outputs = { nixpkgs, ... }:
flake-utils.lib.eachDefaultSystem (system:
let let
pkgs = import nixpkgs { systems = [
inherit system; "x86_64-linux"
}; "aarch64-linux"
pkgsWithRust = import nixpkgs { "x86_64-darwin"
inherit system; "aarch64-darwin"
overlays = [ rust-overlay.overlays.default ];
};
monorepo-deps = with pkgs; [
# for precommit hook
pnpm
husky
]; ];
codex-cli = import ./codex-cli { forAllSystems = f: nixpkgs.lib.genAttrs systems f;
inherit pkgs monorepo-deps;
};
codex-rs = import ./codex-rs {
pkgs = pkgsWithRust;
inherit monorepo-deps;
};
in in
rec { {
packages = { packages = forAllSystems (system:
codex-cli = codex-cli.package; let
codex-rs = codex-rs.package; pkgs = nixpkgs.legacyPackages.${system};
}; codex-rs = pkgs.callPackage ./codex-rs { };
in
devShells = { {
codex-cli = codex-cli.devShell; codex-rs = codex-rs;
codex-rs = codex-rs.devShell; default = codex-rs;
};
apps = {
codex-cli = codex-cli.app;
codex-rs = codex-rs.app;
};
defaultPackage = packages.codex-cli;
defaultApp = apps.codex-cli;
defaultDevShell = devShells.codex-cli;
} }
); );
};
} }