OOKNET                             [ /  search the index  ]  
──────────────────────────────────────────────────────────────────────────────────────
══════════════════════════════════════════════════════════════════════════════════════
OOKNET   [ /  search  ]  
────────────────────────────────────────────────
════════════════════════════════════════════════
 
HASH      7fb3c9a492ed
DATE      2026-07-11
SUBJECT   codex: init package
FILES     4 CHANGED
HASH      7fb3c9a492ed
DATE      2026-07-11
SUBJECT   codex: init package
FILES     4 CHANGED
 

diff --git a/outputs/pkgs/codex/default.nix b/outputs/pkgs/codex/default.nix
new file mode 100644
index 0000000..6f07f88
--- /dev/null
+++ b/outputs/pkgs/codex/default.nix
@@ -0,0 +1,161 @@
+{
+  lib,
+  stdenv,
+  callPackage,
+  rustPlatform,
+  fetchFromGitHub,
+  installShellFiles,
+  bubblewrap,
+  clang,
+  cmake,
+  gitMinimal,
+  libcap,
+  libclang,
+  librusty_v8 ?
+    callPackage ./librusty_v8.nix {
+      inherit (callPackage ./fetchers.nix {}) fetchLibrustyV8;
+    },
+  livekit-libwebrtc,
+  lld,
+  makeBinaryWrapper,
+  nix-update-script,
+  pkg-config,
+  openssl,
+  ripgrep,
+  versionCheckHook,
+  installShellCompletions ? stdenv.buildPlatform.canExecute stdenv.hostPlatform,
+}:
+rustPlatform.buildRustPackage (finalAttrs: {
+  pname = "codex";
+  version = "0.144.1";
+
+  src = fetchFromGitHub {
+    owner = "openai";
+    repo = "codex";
+    tag = "rust-v${finalAttrs.version}";
+    hash = "sha256-KHgrqIZyAmLhTZSRYbb7huBO8neOib/B1Vx/oPW2nEU=";
+  };
+
+  sourceRoot = "${finalAttrs.src.name}/codex-rs";
+
+  cargoHash = "sha256-S4dsZXfmKvJItL2XYKyxfhqdCMATEG6oPjrtVRwkuYc=";
+
+  __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=d
ylib=webrtc"
+    substituteInPlace Cargo.toml \
+      --replace-fail 'lto = "thin"' "" \
+      --replace-fail 'codegen-units = 4' ""
+  '';
+
+  nativeBuildInputs = [
+    clang
+    cmake
+    gitMinimal
+    installShellFiles
+    makeBinaryWrapper
+    pkg-config
+  ];
+
+  buildInputs =
+    [
+      libclang
+      openssl
+    ]
+    ++ lib.optionals stdenv.hostPlatform.isLinux [
+      libcap
+    ];
+
+  # NOTE: set LIBCLANG_PATH so bindgen can locate libclang, and adjust
+  # warning-as-error flags to avoid known false positives (GCC's
+  # stringop-overflow in BoringSSL's a_bitstr.cc) while keeping Clang's
+  # 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"
+        ]
+        ++ lib.optionals stdenv.cc.isClang [
+          "-Wno-error=character-conversion"
+        ]
+      );
+      RUSTY_V8_ARCHIVE = librusty_v8;
+    }
+    // lib.optionalAttrs stdenv.hostPlatform.isDarwin {
+      # Link with lld on Darwin. nixpkgs' classic open-source ld64 fails to inser
t
+      # 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,
+  # apple system configuration, etc. since this is a very fast moving target
+  # (for now), with releases happening every other day, constantly figuring out
+  # which tests need to be skipped, or finding workarounds, was too burdensome,
+  # and in practice not adding any real value. this decision may be reversed in
+  # the future once this software stabilizes.
+  doCheck = false;
+
+  postInstall = lib.optionalString installShellCompletions ''
+    installShellCompletion --cmd codex \
+      --bash <($out/bin/codex completion bash) \
+      --fish <($out/bin/codex completion fish) \
+      --zsh <($out/bin/codex completion zsh)
+  '';
+
+  postFixup = ''
+    wrapProgram $out/bin/codex --prefix PATH : ${
+      lib.makeBinPath ([ripgrep] ++ lib.optionals stdenv.hostPlatform.isLinux [bu
bblewrap])
+    }
+  '';
+
+  doInstallCheck = true;
+  nativeInstallCheckInputs = [versionCheckHook];
+
+  passthru = {
+    updateScript = nix-update-script {
+      extraArgs = [
+        "--use-github-releases"
+        "--version-regex"
+        "^rust-v(\\d+\\.\\d+\\.\\d+)$"
+      ];
+    };
+  };
+
+  meta = {
+    description = "Lightweight coding agent that runs in your terminal";
+    homepage = "https://github.com/openai/codex";
+    changelog = "https://raw.githubusercontent.com/openai/codex/refs/tags/rust-v$
{finalAttrs.version}/CHANGELOG.md";
+    license = lib.licenses.asl20;
+    mainProgram = "codex";
+    maintainers = with lib.maintainers; [
+      delafthi
+      jeafleohj
+      malo
+    ];
+    platforms = lib.platforms.unix;
+  };
+})

diff --git a/outputs/pkgs/codex/default.nix 
b/outputs/pkgs/codex/default.nix
new file mode 100644
index 0000000..6f07f88
--- /dev/null
+++ b/outputs/pkgs/codex/default.nix
@@ -0,0 +1,161 @@
+{
+  lib,
+  stdenv,
+  callPackage,
+  rustPlatform,
+  fetchFromGitHub,
+  installShellFiles,
+  bubblewrap,
+  clang,
+  cmake,
+  gitMinimal,
+  libcap,
+  libclang,
+  librusty_v8 ?
+    callPackage ./librusty_v8.nix {
+      inherit (callPackage ./fetchers.nix {
}) fetchLibrustyV8;
+    },
+  livekit-libwebrtc,
+  lld,
+  makeBinaryWrapper,
+  nix-update-script,
+  pkg-config,
+  openssl,
+  ripgrep,
+  versionCheckHook,
+  installShellCompletions ? stdenv.buildPla
tform.canExecute stdenv.hostPlatform,
+}:
+rustPlatform.buildRustPackage (finalAttrs: 
{
+  pname = "codex";
+  version = "0.144.1";
+
+  src = fetchFromGitHub {
+    owner = "openai";
+    repo = "codex";
+    tag = "rust-v${finalAttrs.version}";
+    hash = "sha256-KHgrqIZyAmLhTZSRYbb7huBO
8neOib/B1Vx/oPW2nEU=";
+  };
+
+  sourceRoot = "${finalAttrs.src.name}/code
x-rs";
+
+  cargoHash = "sha256-S4dsZXfmKvJItL2XYKyxf
hqdCMATEG6oPjrtVRwkuYc=";
+
+  __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 libwebr
tc statically by default,
+    # but nixpkgs provides libwebrtc as a s
hared library.
+    # use LK_CUSTOM_WEBRTC to point to the 
packaged library and adjust linking
+    # to use the shared library instead
+    substituteInPlace $cargoDepsCopy/*/webr
tc-sys-*/build.rs \
+      --replace-fail "cargo:rustc-link-lib=
static=webrtc" "cargo:rustc-link-lib=dylib=w
ebrtc"
+    substituteInPlace Cargo.toml \
+      --replace-fail 'lto = "thin"' "" \
+      --replace-fail 'codegen-units = 4' ""
+  '';
+
+  nativeBuildInputs = [
+    clang
+    cmake
+    gitMinimal
+    installShellFiles
+    makeBinaryWrapper
+    pkg-config
+  ];
+
+  buildInputs =
+    [
+      libclang
+      openssl
+    ]
+    ++ lib.optionals stdenv.hostPlatform.is
Linux [
+      libcap
+    ];
+
+  # NOTE: set LIBCLANG_PATH so bindgen can 
locate libclang, and adjust
+  # warning-as-error flags to avoid known f
alse positives (GCC's
+  # stringop-overflow in BoringSSL's a_bits
tr.cc) while keeping Clang's
+  # character-conversion warning-as-error d
isabled.
+  env =
+    {
+      LIBCLANG_PATH = "${lib.getLib libclan
g}/lib";
+      LK_CUSTOM_WEBRTC = lib.getDev livekit
-libwebrtc;
+      NIX_CFLAGS_COMPILE = toString (
+        lib.optionals stdenv.cc.isGNU [
+          "-Wno-error=stringop-overflow"
+        ]
+        ++ lib.optionals stdenv.cc.isClang 
[
+          "-Wno-error=character-conversion"
+        ]
+      );
+      RUSTY_V8_ARCHIVE = librusty_v8;
+    }
+    // lib.optionalAttrs stdenv.hostPlatfor
m.isDarwin {
+      # Link with lld on Darwin. nixpkgs' c
lassic 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.get
Exe' lld "ld64.lld"}";
+    };
+
+  # NOTE: part of the test suite requires a
ccess to networking, local shells,
+  # apple system configuration, etc. since 
this is a very fast moving target
+  # (for now), with releases happening ever
y other day, constantly figuring out
+  # which tests need to be skipped, or find
ing workarounds, was too burdensome,
+  # and in practice not adding any real val
ue. this decision may be reversed in
+  # the future once this software stabilize
s.
+  doCheck = false;
+
+  postInstall = lib.optionalString installS
hellCompletions ''
+    installShellCompletion --cmd codex \
+      --bash <($out/bin/codex completion ba
sh) \
+      --fish <($out/bin/codex completion fi
sh) \
+      --zsh <($out/bin/codex completion zsh
)
+  '';
+
+  postFixup = ''
+    wrapProgram $out/bin/codex --prefix PAT
H : ${
+      lib.makeBinPath ([ripgrep] ++ lib.opt
ionals stdenv.hostPlatform.isLinux [bubblewr
ap])
+    }
+  '';
+
+  doInstallCheck = true;
+  nativeInstallCheckInputs = [versionCheckH
ook];
+
+  passthru = {
+    updateScript = nix-update-script {
+      extraArgs = [
+        "--use-github-releases"
+        "--version-regex"
+        "^rust-v(\\d+\\.\\d+\\.\\d+)$"
+      ];
+    };
+  };
+
+  meta = {
+    description = "Lightweight coding agent
 that runs in your terminal";
+    homepage = "https://github.com/openai/c
odex";
+    changelog = "https://raw.githubusercont
ent.com/openai/codex/refs/tags/rust-v${final
Attrs.version}/CHANGELOG.md";
+    license = lib.licenses.asl20;
+    mainProgram = "codex";
+    maintainers = with lib.maintainers; [
+      delafthi
+      jeafleohj
+      malo
+    ];
+    platforms = lib.platforms.unix;
+  };
+})
 

diff --git a/outputs/pkgs/codex/fetchers.nix b/outputs/pkgs/codex/fetchers.nix
new file mode 100644
index 0000000..ea0d3b7
--- /dev/null
+++ b/outputs/pkgs/codex/fetchers.nix
@@ -0,0 +1,17 @@
+# not a stable interface, do not reference outside the codex package but make a c
opy if you need
+{
+  lib,
+  stdenv,
+  fetchurl,
+}: {
+  fetchLibrustyV8 = args:
+    fetchurl {
+      name = "librusty_v8-${args.version}";
+      url = "https://github.com/denoland/rusty_v8/releases/download/v${args.versi
on}/librusty_v8_release_${stdenv.hostPlatform.rust.rustcTarget}.a.gz";
+      sha256 = args.shas.${stdenv.hostPlatform.system};
+      meta = {
+        inherit (args) version;
+        sourceProvenance = with lib.sourceTypes; [binaryNativeCode];
+      };
+    };
+}

diff --git a/outputs/pkgs/codex/fetchers.nix
 b/outputs/pkgs/codex/fetchers.nix
new file mode 100644
index 0000000..ea0d3b7
--- /dev/null
+++ b/outputs/pkgs/codex/fetchers.nix
@@ -0,0 +1,17 @@
+# not a stable interface, do not reference 
outside the codex package but make a copy if
 you need
+{
+  lib,
+  stdenv,
+  fetchurl,
+}: {
+  fetchLibrustyV8 = args:
+    fetchurl {
+      name = "librusty_v8-${args.version}";
+      url = "https://github.com/denoland/ru
sty_v8/releases/download/v${args.version}/li
brusty_v8_release_${stdenv.hostPlatform.rust
.rustcTarget}.a.gz";
+      sha256 = args.shas.${stdenv.hostPlatf
orm.system};
+      meta = {
+        inherit (args) version;
+        sourceProvenance = with lib.sourceT
ypes; [binaryNativeCode];
+      };
+    };
+}
 

diff --git a/outputs/pkgs/codex/librusty_v8.nix b/outputs/pkgs/codex/librusty_v8.n
ix
new file mode 100644
index 0000000..cf40ff3
--- /dev/null
+++ b/outputs/pkgs/codex/librusty_v8.nix
@@ -0,0 +1,11 @@
+# auto-generated file -- DO NOT EDIT!
+{fetchLibrustyV8}:
+fetchLibrustyV8 {
+  version = "146.4.0";
+  shas = {
+    x86_64-linux = "sha256-5ktNmeSuKTouhGJEqJuAF4uhA4LBP7WRwfppaPUpEVM=";
+    aarch64-linux = "sha256-2/FlsHyBvbBUvARrQ9I+afz3vMGkwbW0d2mDpxBi7Ng=";
+    x86_64-darwin = "sha256-YwzSQPG77NsHFBfcGDh6uBz2fFScHFFaC0/Pnrpke7c=";
+    aarch64-darwin = "sha256-v+LJvjKlbChUbw+WWCXuaPv2BkBfMQzE4XtEilaM+Yo=";
+  };
+}

diff --git a/outputs/pkgs/codex/librusty_v8.
nix b/outputs/pkgs/codex/librusty_v8.nix
new file mode 100644
index 0000000..cf40ff3
--- /dev/null
+++ b/outputs/pkgs/codex/librusty_v8.nix
@@ -0,0 +1,11 @@
+# auto-generated file -- DO NOT EDIT!
+{fetchLibrustyV8}:
+fetchLibrustyV8 {
+  version = "146.4.0";
+  shas = {
+    x86_64-linux = "sha256-5ktNmeSuKTouhGJE
qJuAF4uhA4LBP7WRwfppaPUpEVM=";
+    aarch64-linux = "sha256-2/FlsHyBvbBUvAR
rQ9I+afz3vMGkwbW0d2mDpxBi7Ng=";
+    x86_64-darwin = "sha256-YwzSQPG77NsHFBf
cGDh6uBz2fFScHFFaC0/Pnrpke7c=";
+    aarch64-darwin = "sha256-v+LJvjKlbChUbw
+WWCXuaPv2BkBfMQzE4XtEilaM+Yo=";
+  };
+}
 

diff --git a/outputs/pkgs/default.nix b/outputs/pkgs/default.nix
index 7148a8e..8e60246 100644
--- a/outputs/pkgs/default.nix
+++ b/outputs/pkgs/default.nix
@@ -52,6 +52,7 @@
       color-scheme-scss = colorSchemeScss;
 
       claude-code = callPackage ./claude-code {};
+      codex = callPackage ./codex {};
 
       claude-desktop = claudeDesktop.package;
       claude-desktop-fhs = claudeDesktop.fhs;

diff --git a/outputs/pkgs/default.nix b/outp
uts/pkgs/default.nix
index 7148a8e..8e60246 100644
--- a/outputs/pkgs/default.nix
+++ b/outputs/pkgs/default.nix
@@ -52,6 +52,7 @@
       color-scheme-scss = colorSchemeScss;
 
       claude-code = callPackage ./claude-co
de {};
+      codex = callPackage ./codex {};
 
       claude-desktop = claudeDesktop.packag
e;
       claude-desktop-fhs = claudeDesktop.fh
s;
 
[ BACK TO LOG ]
──────────────────────────────────────────────────────────────────────────────────────
OOKNET
────────────────────────────────────────────────
OOKNET