Skip to content

Add a self-contained Nix flake - #4699

Closed
colonelpanic8 wants to merge 4 commits into
pingdotgg:mainfrom
colonelpanic8:t3code/local/nix-flake
Closed

colonelpanic8 wants to merge 4 commits into
pingdotgg:mainfrom
colonelpanic8:t3code/local/nix-flake

Conversation

@colonelpanic8

@colonelpanic8 colonelpanic8 commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • add a self-contained Nix package for building the desktop app directly from the checkout
  • provide a lightweight default development shell plus a separate Android SDK/NDK shell and APK builder
  • expose default and client overlays, a headless smoke check, and a cross-platform Home Manager service module

Why

This makes checkout builds reproducible without importing or overriding the t3code package from nixpkgs. Nixpkgs supplies standard tools and build dependencies, while this repository owns its workspace selection, build phases, install layout, wrappers, and desktop integration.

Validation

  • nix fmt -- --check flake.nix nix/android.nix nix/package.nix nix/home-manager/t3code-server.nix
  • nix flake check --no-build --all-systems
  • nix build .#packages.x86_64-linux.unwrapped.pnpmDeps --no-link
  • nix build .#unwrapped --no-link
  • nix build .#checks.x86_64-linux.smoke --no-link
  • git diff --check origin/main...HEAD

Note

Low Risk
New packaging and ops tooling only; no application runtime logic changes, though the Home Manager module can expose Tailscale Serve when enabled.

Overview
Introduces a Nix flake so T3 Code can be built and run from this checkout without relying on nixpkgs’ upstream t3code package.

Packages and overlays: nix/package.nix drives a pnpm-based derivation (web vp build, server CLI build, desktop vp pack) and installs t3 / t3code-desktop with desktop entries and optional macOS .app. Default and optional client-only overlays appear when DesktopBackendMode.ts exists in the tree.

Developer and CI surfaces: Default nix develop shell pins Node 24, pnpm 11, and nixpkgs Electron; Linux adds an Android SDK/NDK shell and nix run .#build-android (script copies the flake source, then prebuilds and Gradle-assembles a release APK). Linux nix flake check includes a headless Electron smoke test under Xvfb that fails on early exit or renderer ReferenceError-style boot failures.

Deployment: A Home Manager module (services.t3code) runs a persistent headless t3 serve via user systemd (Linux) or launchd (macOS), with optional Tailscale Serve and a broad default PATH for agent tooling.

Reviewed by Cursor Bugbot for commit a72f355. Bugbot is set up for automated code reviews on this repo. Configure here.

Note

Add a self-contained Nix flake for building, developing, and deploying T3 Code

  • flake.nix exposes packages for aarch64/x86_64 Linux and macOS: nix build .#t3code produces t3 (server CLI) and t3code-desktop (Electron app), with a macOS .app bundle and a client variant that forces client-only backend mode.
  • nix develop provides a dev shell with Node 24, pnpm 11, and Electron 41 pre-configured via ELECTRON_OVERRIDE_DIST_PATH.
  • nix/android.nix adds a Linux-only nix run .#build-android app and Android dev shell with a full SDK/NDK/JDK toolchain; nix/scripts/build-android-apk.sh handles the full APK build and export.
  • nix/home-manager/t3code-server.nix adds a Home Manager module (services.t3code) that runs a persistent headless server as a systemd user service (Linux) or LaunchAgent (macOS), with optional Tailscale Serve integration.
  • nix flake check on Linux runs a headless Xvfb smoke test that fails on early process exit or renderer ReferenceErrors.

Macroscope summarized a72f355.

@coderabbitai

coderabbitai Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 3649fcae-0bed-45b2-b29c-9f31e76d2c3f

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:XL 500-999 changed lines (additions + deletions). labels Jul 28, 2026
Comment thread nix/scripts/build-android-apk.sh
Comment thread flake.nix
Comment thread nix/package.nix
Comment thread nix/package.nix
Comment thread nix/scripts/build-android-apk.sh
@macroscopeapp

macroscopeapp Bot commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Needs human review

This PR introduces substantial new Nix-based build and packaging infrastructure (838 lines across 5 new files). While it doesn't modify existing application code, the scope and complexity of the new build system, combined with the author being new to this codebase, warrants human review to ensure alignment with project standards.

You can customize Macroscope's approvability policy. Learn more.

Comment thread nix/scripts/build-android-apk.sh Outdated
@colonelpanic8
colonelpanic8 force-pushed the t3code/local/nix-flake branch from 93e883a to 1c43295 Compare July 28, 2026 03:45
Comment thread nix/home-manager/t3code-server.nix Outdated
@colonelpanic8
colonelpanic8 force-pushed the t3code/local/nix-flake branch from 1c43295 to 2623d84 Compare July 28, 2026 03:47

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 690c0a6. Configure here.

Comment thread flake.nix Outdated
macroscopeapp[bot]
macroscopeapp Bot previously approved these changes Jul 28, 2026
colonelpanic8 added a commit to colonelpanic8/t3code that referenced this pull request Aug 10, 2026
colonelpanic8 added a commit to colonelpanic8/t3code that referenced this pull request Aug 11, 2026
@colonelpanic8
colonelpanic8 force-pushed the t3code/local/nix-flake branch from 362fa78 to a72f355 Compare August 13, 2026 06:53
@macroscopeapp
macroscopeapp Bot dismissed their stale review August 13, 2026 06:53

Dismissing prior approval to re-evaluate a72f355

@t3-code t3-code Bot mentioned this pull request Aug 20, 2026
2 tasks done
@t3dotgg

t3dotgg commented Aug 23, 2026

Copy link
Copy Markdown
Member

Note

🤖 GPT-5.6 Sol responding on behalf of Theo

Closing this PR after an automated pass over open pull requests. Adds a new unsupported distribution or deployment system that increases ongoing maintenance.

@t3dotgg t3dotgg closed this Aug 23, 2026
colonelpanic8 added a commit to colonelpanic8/t3code that referenced this pull request Aug 28, 2026
colonelpanic8 added a commit to colonelpanic8/t3code that referenced this pull request Aug 31, 2026
colonelpanic8 added a commit to colonelpanic8/t3code that referenced this pull request Sep 2, 2026
colonelpanic8 added a commit to colonelpanic8/t3code that referenced this pull request Sep 3, 2026
colonelpanic8 added a commit to colonelpanic8/t3code that referenced this pull request Sep 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XL 500-999 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants