Files
codex/codex-rs/default.nix
Rohan Godha 0644ba7b7e 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)
2026-02-20 19:32:15 -08:00

57 lines
1.7 KiB
Nix
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{
cmake,
llvmPackages,
openssl,
libcap ? null,
rustPlatform,
pkg-config,
lib,
stdenv,
version ? "0.0.0",
...
}:
rustPlatform.buildRustPackage (_: {
env.PKG_CONFIG_PATH = lib.makeSearchPathOutput "dev" "lib/pkgconfig" (
[ openssl ] ++ lib.optionals stdenv.isLinux [ libcap ]
);
pname = "codex-rs";
inherit version;
cargoLock.lockFile = ./Cargo.lock;
doCheck = false;
src = ./.;
# Patch the workspace Cargo.toml so that cargo embeds the correct version in
# CARGO_PKG_VERSION (which the binary reads via env!("CARGO_PKG_VERSION")).
# On release commits the Cargo.toml already contains the real version and
# this sed is a no-op.
postPatch = ''
sed -i 's/^version = "0\.0\.0"$/version = "${version}"/' Cargo.toml
'';
nativeBuildInputs = [
cmake
llvmPackages.clang
llvmPackages.libclang.lib
openssl
pkg-config
] ++ lib.optionals stdenv.isLinux [
libcap
];
cargoLock.outputHashes = {
"ratatui-0.29.0" = "sha256-HBvT5c8GsiCxMffNjJGLmHnvG77A6cqEL+1ARurBXho=";
"crossterm-0.28.1" = "sha256-6qCtfSMuXACKFb9ATID39XyFDIEMFDmbx6SSmNe+728=";
"nucleo-0.5.0" = "sha256-Hm4SxtTSBrcWpXrtSqeO0TACbUxq3gizg1zD/6Yw/sI=";
"nucleo-matcher-0.3.1" = "sha256-Hm4SxtTSBrcWpXrtSqeO0TACbUxq3gizg1zD/6Yw/sI=";
"runfiles-0.1.0" = "sha256-uJpVLcQh8wWZA3GPv9D8Nt43EOirajfDJ7eq/FB+tek=";
"tokio-tungstenite-0.28.0" = "sha256-hJAkvWxDjB9A9GqansahWhTmj/ekcelslLUTtwqI7lw=";
"tungstenite-0.27.0" = "sha256-AN5wql2X2yJnQ7lnDxpljNw0Jua40GtmT+w3wjER010=";
};
meta = with lib; {
description = "OpenAI Codex commandline interface rust implementation";
license = licenses.asl20;
homepage = "https://github.com/openai/codex";
mainProgram = "codex";
};
})