Files
millerson-overlay.nix/packages/codex-oauth-proxy/package.nix
T
Marmel Coder 55f6a0b7ed feat(codex-oauth-proxy): add 1.1.1 Codex OAuth proxy package
Packages dvcrn/codex-oauth-proxy, which exposes a ChatGPT Codex account through OpenAI-compatible APIs, as a buildGoModule derivation. Builds only cmd/codex-oauth-proxy because the worker package is js/wasm code, and passes -buildvcs=false because the Nix source has no .git. Upstream Go tests run offline, so doCheck is enabled.
2026-11-12 02:04:06 +03:00

74 lines
1.9 KiB
Nix

{
lib,
buildGoModule,
fetchFromGitHub,
}:
buildGoModule rec {
pname = "codex-oauth-proxy";
version = "1.1.1";
src = fetchFromGitHub {
owner = "dvcrn";
repo = "codex-oauth-proxy";
# Upstream tags are bare semver, without the "v" prefix.
rev = version;
hash = "sha256-WZN+OVvK5/R46Ko01jw4m9jI9BcvpZzxWifcui90/g4=";
};
vendorHash = "sha256-hb0rGd+HZHSV/sLXiIa7LPkXVuRqdXrQHZxM4v5sgvs=";
env.CGO_ENABLED = 0;
# cmd/codex-oauth-proxy-worker and parts of internal/server are js && wasm
# Cloudflare Worker code needing syscall/js, so only the server is buildable.
subPackages = [ "cmd/codex-oauth-proxy" ];
# The Nix source tree has no .git, so Go's VCS stamping fails without it.
# Set before the build and check phases, which both call `go`.
preConfigure = ''
export GOFLAGS="$GOFLAGS -buildvcs=false"
'';
ldflags = [
"-s"
"-w"
];
# Upstream CI runs `go test -v ./...` and the suite only uses httptest and
# t.Setenv, so it needs neither network nor credentials. The default check
# phase would reuse subPackages and test only the server, hence the override.
doCheck = true;
checkPhase = ''
runHook preCheck
# Tests may read assets relative to their package directory.
export GOFLAGS=''${GOFLAGS//-trimpath/}
go test -v ./...
runHook postCheck
'';
passthru = {
category = "AI LLM Gateway";
updateScript = [
"nix-update"
"--flake"
".#codex-oauth-proxy"
];
};
meta = {
description = "Local proxy exposing a ChatGPT Codex account through OpenAI-compatible APIs";
homepage = "https://github.com/dvcrn/codex-oauth-proxy";
changelog = "https://github.com/dvcrn/codex-oauth-proxy/releases/tag/${version}";
license = lib.licenses.mit;
sourceProvenance = with lib.sourceTypes; [ fromSource ];
mainProgram = "codex-oauth-proxy";
platforms = lib.platforms.unix;
maintainers = [ ];
};
}