mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-25 17:55:21 +00:00
[Backport to release-26.05] codex: 0.133.0 -> 0.146.0 (#552615)
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
librusty_v8 ? callPackage ./librusty_v8.nix {
|
||||
inherit (callPackage ./fetchers.nix { }) fetchLibrustyV8;
|
||||
},
|
||||
livekit-libwebrtc,
|
||||
lld,
|
||||
makeBinaryWrapper,
|
||||
nix-update-script,
|
||||
pkg-config,
|
||||
@@ -25,39 +25,40 @@
|
||||
}:
|
||||
rustPlatform.buildRustPackage (finalAttrs: {
|
||||
pname = "codex";
|
||||
version = "0.133.0";
|
||||
version = "0.146.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "openai";
|
||||
repo = "codex";
|
||||
tag = "rust-v${finalAttrs.version}";
|
||||
hash = "sha256-RTxhhZjZ/64N60pmbNVzLwcSBomn67pPDpOjkL6RPUw=";
|
||||
hash = "sha256-/kTIOX/klxm1nq2bJsBqS8f1jZZp2ilaTeULQFPJgDk=";
|
||||
};
|
||||
|
||||
sourceRoot = "${finalAttrs.src.name}/codex-rs";
|
||||
|
||||
cargoHash = "sha256-J4wvPn4lSTSsJrTG56vkhJe2F2b+fUvJLEd+qKQ9LUg=";
|
||||
cargoHash = "sha256-N9jbH/cgAyu2QxneSnpkdaF0MgV3ZtDmN9q6rr9u+hE=";
|
||||
|
||||
# Match upstream's release build for the codex binary only.
|
||||
__structuredAttrs = true;
|
||||
|
||||
# Match upstream's release build for the codex binary, plus its
|
||||
# codex-code-mode-host runtime companion for out-of-process V8 execution.
|
||||
cargoBuildFlags = [
|
||||
"--package"
|
||||
"codex-cli"
|
||||
"--package"
|
||||
"codex-code-mode-host"
|
||||
];
|
||||
cargoCheckFlags = [
|
||||
"--package"
|
||||
"codex-cli"
|
||||
"--package"
|
||||
"codex-code-mode-host"
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# webrtc-sys asks rustc to link libwebrtc statically by default,
|
||||
# but nixpkgs provides libwebrtc as a shared library.
|
||||
# use LK_CUSTOM_WEBRTC to point to the packaged library and adjust linking
|
||||
# to use the shared library instead
|
||||
substituteInPlace $cargoDepsCopy/*/webrtc-sys-*/build.rs \
|
||||
--replace-fail "cargo:rustc-link-lib=static=webrtc" "cargo:rustc-link-lib=dylib=webrtc"
|
||||
substituteInPlace Cargo.toml \
|
||||
--replace-fail 'lto = "fat"' "" \
|
||||
--replace-fail 'codegen-units = 1' ""
|
||||
--replace-fail 'lto = "thin"' "" \
|
||||
--replace-fail 'codegen-units = 4' ""
|
||||
'';
|
||||
|
||||
nativeBuildInputs = [
|
||||
@@ -83,7 +84,6 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
# character-conversion warning-as-error disabled.
|
||||
env = {
|
||||
LIBCLANG_PATH = "${lib.getLib libclang}/lib";
|
||||
LK_CUSTOM_WEBRTC = lib.getDev livekit-libwebrtc;
|
||||
NIX_CFLAGS_COMPILE = toString (
|
||||
lib.optionals stdenv.cc.isGNU [
|
||||
"-Wno-error=stringop-overflow"
|
||||
@@ -93,6 +93,11 @@ rustPlatform.buildRustPackage (finalAttrs: {
|
||||
]
|
||||
);
|
||||
RUSTY_V8_ARCHIVE = librusty_v8;
|
||||
}
|
||||
// lib.optionalAttrs stdenv.hostPlatform.isDarwin {
|
||||
# Link with lld on Darwin. nixpkgs' classic open-source ld64 fails to insert
|
||||
# ARM64 branch thunks for this binary, producing `b(l) ARM64 branch out of range`.
|
||||
NIX_CFLAGS_LINK = "-fuse-ld=${lib.getExe' lld "ld64.lld"}";
|
||||
};
|
||||
|
||||
# NOTE: part of the test suite requires access to networking, local shells,
|
||||
|
||||
Reference in New Issue
Block a user