- Nix 60%
- Shell 40%
t3code-nix #
Nix flake packaging for the upstream T3 Code desktop application, with the upstream t3 CLI exposed as an optional secondary package.
Why this exists #
Upstream currently ships Linux AppImage and Debian packages, macOS desktop archives, and the CLI through npm. This repository packages those artifacts directly in Nix so users can install pinned versions without ad hoc runtime downloads.
The desktop application is the primary output of this flake.
Inspiration #
The repository structure and update automation approach are inspired by sadjow/codex-cli-nix.
Packages #
t3code/t3code-desktop: desktop application packaged from the upstream Linux Debian package or macOS zip archive, depending on platformt3code-cli/t3: optional CLI packaged from the upstream npm tarballdefault: desktop application
Install #
Run the desktop application directly:
nix run github:Sawrz/t3code-nix
Run the CLI directly:
nix run github:Sawrz/t3code-nix#t3
Install the desktop app into your profile:
nix profile install github:Sawrz/t3code-nix#t3code
Install the CLI into your profile:
nix profile install github:Sawrz/t3code-nix#t3
Use as a flake input:
{
inputs.t3code-nix.url = "github:Sawrz/t3code-nix";
outputs = { self, nixpkgs, t3code-nix, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [ t3code-nix.overlays.default ];
};
in
{
packages.${system}.default = pkgs.t3code;
};
}
Enable Claude Code #
Claude Code is unfree in nixpkgs. The packages under packages.${system} are evaluated with this flake's nixpkgs package set, so a consumer's nixpkgs.config.allowUnfree setting does not apply to them.
The recommended approach is to use the overlay. callPackage then takes claude-code from the same package set whose unfree policy you configured:
{
outputs = { self, nixpkgs, t3code-nix, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config.allowUnfreePredicate = pkg:
nixpkgs.lib.getName pkg == "claude-code";
overlays = [ t3code-nix.overlays.default ];
};
in
{
packages.${system}.default = pkgs.t3code.override {
claudeSupport = true;
};
};
}
If you use a package from the flake's packages output, pass the Claude Code derivation from your configured package set explicitly:
inputs.t3code-nix.packages.${pkgs.system}.t3code-desktop.override {
claudeSupport = true;
claude-code = pkgs.claude-code;
}
You can also build the package with callPackage directly. It supplies dependencies, including claude-code, from your configured pkgs:
pkgs.callPackage (inputs.t3code-nix.outPath + "/package.nix") {
claudeSupport = true;
}
Enable Grok #
grokSupport = true adds xAI's grok CLI (nixpkgs grok-build) to the launcher's PATH. grok-build is also unfree, so it follows the same rules as Claude Code above: allow "grok-build" in your unfree predicate and either use the overlay or pass grok-build = pkgs.grok-build; explicitly.
pkgs.t3code.override {
grokSupport = true;
}
What gets installed #
Desktop package:
x86_64-linux: fetches the upstreamamd64.deb, patches its ELF files withautoPatchelfHook, and installs the application under$out/lib/t3codeaarch64-linux: fetches the matching upstreamarm64.deband uses the same Debian-based packaging flowaarch64-darwin: fetches the matching upstream zip archive and installs the.appbundle into the Nix store with at3codelauncher
CLI package:
- fetches the upstream
t3npm tarball - vendors the locked Node dependency graph in the Nix store
- runs the packaged entrypoint with the packaged Node interpreter
Update automation #
The GitHub Actions update workflow checks upstream releases every six hours.
An update is valid only when all of these exist for the same version:
- a GitHub release in
pingdotgg/t3codewithamd64.deb,arm64.deb, andarm64.zipdesktop assets - a matching npm package version
t3@<version>
When a new version is found, the updater:
- refreshes
package.nixfor the Linux Debian packages and macOS desktop archives - refreshes
package-cli.nixfor the CLI package - regenerates
npm/package.json - regenerates
npm/package-lock.json - runs
nix flake check - evaluates the Darwin desktop and CLI derivations
- builds
.#t3code - builds
.#t3code-cli - opens a pull request
Pull requests and pushes are validated separately by CI on:
ubuntu-latestforx86_64-linuxubuntu-24.04-armforaarch64-linuxmacos-15foraarch64-darwin
Merged updates are released automatically on main by tagging the repository with v<version> and publishing a matching GitHub release.
Repository Setup #
For the automation to work cleanly, configure these repository settings:
- Actions > General > Workflow permissions:
Read and write permissions - Actions > General > Allow GitHub Actions to create and approve pull requests: enabled
- Pull Requests: auto-merge enabled
- Branches: protect
mainand require the three CI jobs fromCI - Branches: automatically delete head branches enabled
Recommended secret:
GH_TOKEN_FOR_UPDATES: a fine-grained personal access token withContents: Read and writeandPull requests: Read and write
The updater falls back to GITHUB_TOKEN if the secret is absent, but in that mode the bot-created PR will not trigger pull_request CI.
Limitations #
- Desktop support is currently
x86_64-linux,aarch64-linux, andaarch64-darwin. - The desktop package is built from upstream binary artifacts.
- The CLI package is optional and follows upstream npm publication.
- GitHub Actions is configured to build the flake on
x86_64-linux,aarch64-linux, andaarch64-darwin.
Development #
Update to the latest upstream release:
nix develop -c ./scripts/update.sh
Check whether an update is available:
nix develop -c ./scripts/update.sh --check
Update to a specific version:
nix develop -c ./scripts/update.sh --version 0.0.4