# t3code-flake Standalone Nix packaging for [`pingdotgg/t3code`](https://github.com/pingdotgg/t3code). This repository does not rely on upstream Nix packaging. It fetches the upstream source as a non-flake input and builds local package expressions around that source tree. ## What It Exports For each supported system, the flake exports: - `apps..default` - `apps..t3code-desktop` - `apps..t3code-server` - `packages..default` - `packages..t3code-desktop` - `packages..t3code-server` - `checks..t3code-desktop` - `checks..t3code-server` Current `default` points to the `t3code-desktop`. There are also `desktop` and `server` shorthands available for `apps` and `packages`. ## Usage Inspect the flake surface: ```bash nix flake show --all-systems ``` Build the desktop package: ```bash nix build .#t3code-desktop ``` Build the server package: ```bash nix build .#t3code-server ``` Run the desktop app: ```bash nix run .#t3code-desktop ``` Run the server app: ```bash nix run .#t3code-server ``` ## Agent CLI Support Both packages can be overridden to add AI agent CLIs to the runtime `PATH`: - `withCodex` adds `github:numtide/llm-agents.nix#codex` - `withClaudeCode` adds `github:numtide/llm-agents.nix#claude-code` - `withOpencode` adds `github:numtide/llm-agents.nix#opencode` Agent CLIs can be overridden as well using `codexPackage`, `claudeCodePackage` and `opencodePackage` respectively. These overrides wrap the finished package in a small `postBuild` layer, so changing the agent flags does not rebuild the full T3 Code package. In a Nix expression, use the same package override directly (using `perSystem` from [`github:numtide/blueprint`](https://github.com/numtide/blueprint)): ```nix {perSystem, pkgs, ...}: { home.packages = [ (perSystem.t3code.desktop.override { withCodex = true; claudeCodePackage = pkgs.claude-code-bin; withClaudeCode = true; opencodePackage = perSystem.foobar.my-awesome-opencode-fork; withOpencode = true; }) ]; } ``` ## Layout ```text . ├── flake.nix ├── flake.lock ├── README.md └── packages ├── common.nix ├── scripts │ ├── canonicalize-node-modules.ts │ └── normalize-bun-binaries.ts ├── t3code-desktop │ ├── build-nix-desktop-package.mjs │ ├── default.nix │ └── desktop-nix-autoupdate.patch └── t3code-server └── default.nix ``` ## Notes - `packages/common.nix` contains the shared Bun workspace and `node-pty` setup used by both packages. - `packages/scripts/*.ts` contains the Bun install-tree normalization helpers used by `packages/common.nix`. - `packages/t3code-desktop/build-nix-desktop-package.mjs` is local packaging glue carried by this repo. - `packages/t3code-desktop/desktop-nix-autoupdate.patch` is a downstream patch for desktop auto-update messaging in package-managed installs. - Upstream source is pinned in `flake.lock` via the `t3code` input. - Optional agent CLI packages are pinned in `flake.lock` via the `llm-agents` input.