t3code: init at 0.0.15#497465
Conversation
|
Here are some suggested improvements on top of this PR:
Patch (applies on top of current PR)--- a/pkgs/by-name/t3/t3code/package.nix
+++ b/pkgs/by-name/t3/t3code/package.nix
@@ -2,12 +2,17 @@
lib,
stdenv,
bun,
+ copyDesktopItems,
+ electron,
fetchFromGitHub,
+ installShellFiles,
+ makeDesktopItem,
makeBinaryWrapper,
node-gyp,
- nodejs_24,
+ nodejs,
python3,
writableTmpDirAsHomeHook,
+ nix-update-script,
}:
stdenv.mkDerivation (finalAttrs: {
@@ -14,5 +19,5 @@
pname = "t3code";
- version = "0.0.3-unstable-2026-03-06";
+ version = "0.0.4";
src = fetchFromGitHub {
owner = "pingdotgg";
@@ -19,6 +24,6 @@
repo = "t3code";
- rev = "5a90b6be9c902df934bada91b543865c197cfb2d";
- hash = "sha256-lUXScjYjlBgg4GHLs7Z2L2niQsFlkwsdklxQpQV0Wkw=";
+ tag = "v\${finalAttrs.version}";
+ hash = "sha256-66qxVToZxH6AUDWUkA7OCJkrlEe3eBIX1jHghGT1/T0=";
};
node_modules = stdenv.mkDerivation {
@@ -25,14 +30,9 @@
pname = "\${finalAttrs.pname}-node_modules";
inherit (finalAttrs) src version;
- impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
- "GIT_PROXY_COMMAND"
- "SOCKS_SERVER"
- ];
-
nativeBuildInputs = [
bun
- nodejs_24
+ nodejs
writableTmpDirAsHomeHook
];
@@ -42,9 +42,6 @@
buildPhase = ''
runHook preBuild
- export HOME=\$(mktemp -d)
- export BUN_INSTALL_CACHE_DIR=\$(mktemp -d)
-
for packageJson in \
apps/server/package.json \
apps/web/package.json \
@@ -61,6 +58,7 @@
--frozen-lockfile \
--filter ./apps/server \
--filter ./apps/web \
+ --filter ./apps/desktop \
--filter ./packages/contracts \
--filter ./packages/shared
@@ -76,7 +74,7 @@
runHook postInstall
'';
- outputHash = "sha256-ImZNhJhS4dMLLT+TV3+BezrTI8rWBRfiK6GoD9kW1Ys=";
+ outputHash = "sha256-nJUgJoT2HNSjzzUDZ2aRhTJFcfTDQvuoQ4F42Fz+/90=";
outputHashAlgo = "sha256";
outputHashMode = "recursive";
};
@@ -83,9 +81,11 @@
nativeBuildInputs = [
bun
+ copyDesktopItems
+ installShellFiles
makeBinaryWrapper
node-gyp
- nodejs_24
+ nodejs
python3
writableTmpDirAsHomeHook
];
@@ -98,22 +98,12 @@
chmod -R u+rwX node_modules
patchShebangs node_modules
- export HOME=\$(mktemp -d)
- export PATH="\$PWD/node_modules/.bin:\$PATH"
- export npm_config_nodedir=\${nodejs_24}
+ # Compile node-pty native addon (no linux prebuild shipped)
+ cd node_modules/.bun/node-pty@*/node_modules/node-pty
+ node-gyp rebuild
+ node scripts/post-install.js
+ cd "\$NIX_BUILD_TOP/\$sourceRoot"
- nodePtyDir="\$(find node_modules/.bun -maxdepth 1 -type d -name 'node-pty@*' | head -n 1)"
- if [ -z "\$nodePtyDir" ]; then
- echo "Could not locate node-pty in node_modules/.bun" >&2
- exit 1
- fi
-
- (
- cd "\$nodePtyDir/node_modules/node-pty"
- node-gyp rebuild
- node scripts/post-install.js
- )
-
runHook postConfigure
'';
@@ -122,6 +112,7 @@
bun run --cwd apps/web build
bun run --cwd apps/server build
+ bun run --cwd apps/desktop build
runHook postBuild
'';
@@ -129,22 +120,25 @@
installPhase = ''
runHook preInstall
- mkdir -p \
- \$out/bin \
- \$out/libexec/t3code/apps/server \
- \$out/libexec/t3code/apps/web \
- \$out/libexec/t3code/packages/shared \
- \$out/libexec/t3code/packages/contracts
- cp -R node_modules \$out/libexec/t3code/
- cp -R apps/server/node_modules \$out/libexec/t3code/apps/server/
- cp -R apps/server/dist \$out/libexec/t3code/apps/server/
- install -Dm644 apps/web/package.json \$out/libexec/t3code/apps/web/package.json
- install -Dm644 packages/shared/package.json \$out/libexec/t3code/packages/shared/package.json
- install -Dm644 packages/contracts/package.json \$out/libexec/t3code/packages/contracts/package.json
+ mkdir -p \$out/libexec/t3code/apps/{server,desktop}
+ cp -R --no-preserve=mode node_modules \$out/libexec/t3code/
+ cp -R --no-preserve=mode apps/server/{node_modules,dist} \$out/libexec/t3code/apps/server/
+ cp -R --no-preserve=mode apps/desktop/{node_modules,dist-electron} \$out/libexec/t3code/apps/desktop/
- makeWrapper \${lib.getExe nodejs_24} \$out/bin/t3code \
- --add-flags "\$out/libexec/t3code/apps/server/dist/index.mjs"
+ # Remove broken @t3tools workspace symlinks (inlined by tsdown at build time)
+ find \$out/libexec/t3code -xtype l -delete
+
+ # Server wrapper
+ makeWrapper \${lib.getExe nodejs} \$out/bin/t3code \
+ --add-flags "\$out/libexec/t3code/apps/server/dist/index.mjs"
+
+ # Desktop wrapper
+ makeWrapper \${lib.getExe electron} \$out/bin/t3code-desktop \
+ --add-flags "\$out/libexec/t3code/apps/desktop/dist-electron/main.js" \
+ --add-flags "\\'\\'\\'\${NIXOS_OZONE_WL:+\\'\\'\\'\${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}"
+
+ install -Dm644 assets/prod/black-universal-1024.png \$out/share/icons/hicolor/1024x1024/apps/t3code.png
runHook postInstall
'';
+ postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
+ installShellCompletion --cmd t3code \
+ --bash <(\$out/bin/t3code --completions bash) \
+ --zsh <(\$out/bin/t3code --completions zsh) \
+ --fish <(\$out/bin/t3code --completions fish)
+ '';
+
+ desktopItems = [
+ (makeDesktopItem {
+ name = "t3code";
+ desktopName = "T3 Code";
+ comment = finalAttrs.meta.description;
+ exec = "t3code-desktop %U";
+ terminal = false;
+ icon = "t3code";
+ startupWMClass = "t3code";
+ categories = [
+ "Development"
+ "Utility"
+ ];
+ })
+ ];
+
+ passthru.updateScript = nix-update-script {
+ extraArgs = [
+ "--subpackage"
+ "node_modules"
+ ];
+ };
+
meta = {
description = "Minimal web GUI for coding agents";
homepage = "https://github.com/pingdotgg/t3code";
license = lib.licenses.mit;
- maintainers = with lib.maintainers; [ imalison ];
+ maintainers = with lib.maintainers; [
+ imalison
+ qweered
+ ];
mainProgram = "t3code";
- platforms = lib.platforms.linux;
- sourceProvenance = with lib.sourceTypes; [ fromSource ];
};
}) |
Optional: closure size reduction (~500MB savings)The current package ships all 583 The patch prunes unreferenced Results (tested on
The runtime dep list would need updating if new external dependencies are added to the server/desktop tsdown configs. Patch (applies on top of current PR HEAD)--- a/pkgs/by-name/t3/t3code/package.nix
+++ b/pkgs/by-name/t3/t3code/package.nix
@@ -2,12 +2,17 @@
lib,
stdenv,
bun,
+ copyDesktopItems,
+ electron,
fetchFromGitHub,
+ installShellFiles,
+ makeDesktopItem,
makeBinaryWrapper,
node-gyp,
- nodejs_24,
+ nodejs,
python3,
writableTmpDirAsHomeHook,
+ nix-update-script,
}:
stdenv.mkDerivation (finalAttrs: {
@@ -14,5 +19,5 @@
pname = "t3code";
- version = "0.0.3-unstable-2026-03-06";
+ version = "0.0.4";
src = fetchFromGitHub {
owner = "pingdotgg";
@@ -19,6 +24,6 @@
repo = "t3code";
- rev = "5a90b6be9c902df934bada91b543865c197cfb2d";
- hash = "sha256-lUXScjYjlBgg4GHLs7Z2L2niQsFlkwsdklxQpQV0Wkw=";
+ tag = "v${finalAttrs.version}";
+ hash = "sha256-66qxVToZxH6AUDWUkA7OCJkrlEe3eBIX1jHghGT1/T0=";
};
node_modules = stdenv.mkDerivation {
@@ -25,14 +30,9 @@
pname = "${finalAttrs.pname}-node_modules";
inherit (finalAttrs) src version;
- impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
- "GIT_PROXY_COMMAND"
- "SOCKS_SERVER"
- ];
-
nativeBuildInputs = [
bun
- nodejs_24
+ nodejs
writableTmpDirAsHomeHook
];
@@ -42,9 +42,6 @@
buildPhase = ''
runHook preBuild
- export HOME=$(mktemp -d)
- export BUN_INSTALL_CACHE_DIR=$(mktemp -d)
-
for packageJson in \
apps/server/package.json \
apps/web/package.json \
@@ -61,6 +58,7 @@
--frozen-lockfile \
--filter ./apps/server \
--filter ./apps/web \
+ --filter ./apps/desktop \
--filter ./packages/contracts \
--filter ./packages/shared
@@ -76,7 +74,7 @@
runHook postInstall
'';
- outputHash = "sha256-ImZNhJhS4dMLLT+TV3+BezrTI8rWBRfiK6GoD9kW1Ys=";
+ outputHash = "sha256-nJUgJoT2HNSjzzUDZ2aRhTJFcfTDQvuoQ4F42Fz+/90=";
outputHashAlgo = "sha256";
outputHashMode = "recursive";
};
@@ -83,9 +81,11 @@
nativeBuildInputs = [
bun
+ copyDesktopItems
+ installShellFiles
makeBinaryWrapper
node-gyp
- nodejs_24
+ nodejs
python3
writableTmpDirAsHomeHook
];
@@ -98,22 +98,12 @@
chmod -R u+rwX node_modules
patchShebangs node_modules
- export HOME=$(mktemp -d)
- export PATH="$PWD/node_modules/.bin:$PATH"
- export npm_config_nodedir=${nodejs_24}
+ # Compile node-pty native addon (no linux prebuild shipped)
+ cd node_modules/.bun/node-pty@*/node_modules/node-pty
+ node-gyp rebuild
+ node scripts/post-install.js
+ cd "$NIX_BUILD_TOP/$sourceRoot"
- nodePtyDir="$(find node_modules/.bun -maxdepth 1 -type d -name 'node-pty@*' | head -n 1)"
- if [ -z "$nodePtyDir" ]; then
- echo "Could not locate node-pty in node_modules/.bun" >&2
- exit 1
- fi
-
- (
- cd "$nodePtyDir/node_modules/node-pty"
- node-gyp rebuild
- node scripts/post-install.js
- )
-
runHook postConfigure
'';
@@ -122,6 +112,7 @@
bun run --cwd apps/web build
bun run --cwd apps/server build
+ bun run --cwd apps/desktop build
runHook postBuild
'';
@@ -129,22 +120,76 @@
installPhase = ''
runHook preInstall
- mkdir -p \
- $out/bin \
- $out/libexec/t3code/apps/server \
- $out/libexec/t3code/apps/web \
- $out/libexec/t3code/packages/shared \
- $out/libexec/t3code/packages/contracts
- cp -R node_modules $out/libexec/t3code/
- cp -R apps/server/node_modules $out/libexec/t3code/apps/server/
- cp -R apps/server/dist $out/libexec/t3code/apps/server/
- install -Dm644 apps/web/package.json $out/libexec/t3code/apps/web/package.json
- install -Dm644 packages/shared/package.json $out/libexec/t3code/packages/shared/package.json
- install -Dm644 packages/contracts/package.json $out/libexec/t3code/packages/contracts/package.json
+ mkdir -p $out/libexec/t3code/apps/{server,desktop}
+ cp -R --no-preserve=mode node_modules $out/libexec/t3code/
+ cp -R --no-preserve=mode apps/server/{node_modules,dist} $out/libexec/t3code/apps/server/
+ cp -R --no-preserve=mode apps/desktop/{node_modules,dist-electron} $out/libexec/t3code/apps/desktop/
- makeWrapper ${lib.getExe nodejs_24} $out/bin/t3code \
+ # Prune .bun store to only runtime dependencies
+ (
+ cd $out/libexec/t3code
+ keepList=$(mktemp)
+ workList=$(mktemp)
+
+ # Seed with only runtime-required packages (not devDependencies)
+ for pkg in \
+ effect @effect/platform-node @pierre/diffs ws node-pty open \
+ electron-updater; do
+ for appDir in apps/server/node_modules apps/desktop/node_modules; do
+ if [ -L "$appDir/$pkg" ]; then
+ readlink -f "$appDir/$pkg"
+ fi
+ done
+ done | sed -n 's|.*/node_modules/.bun/\([^/]*\)/.*|\1|p' \
+ | sort -u > "$workList"
+
+ # Iteratively resolve transitive deps
+ while [ -s "$workList" ]; do
+ comm -23 "$workList" "$keepList" > "$workList.new"
+ mv "$workList.new" "$workList"
+ [ -s "$workList" ] || break
+ cat "$workList" >> "$keepList"
+ sort -u -o "$keepList" "$keepList"
+
+ while IFS= read -r pkg; do
+ [ -d "node_modules/.bun/$pkg" ] || continue
+ find "node_modules/.bun/$pkg" -type l -not -path '*/.bin/*' -exec readlink -f {} \;
+ done < "$workList" \
+ | sed -n 's|.*/node_modules/.bun/\([^/]*\)/.*|\1|p' \
+ | sort -u > "$workList.new"
+ mv "$workList.new" "$workList"
+ done
+
+ for dir in node_modules/.bun/*/; do
+ dirName=$(basename "$dir")
+ if ! grep -qxF "$dirName" "$keepList" 2>/dev/null; then
+ rm -rf "$dir"
+ fi
+ done
+
+ rm -f "$keepList" "$workList"
+ )
+
+ # Strip node-pty build artifacts and prebuilds (58MB+ savings)
+ find $out/libexec/t3code -path '*/node-pty/prebuilds' -exec rm -rf {} +
+ find $out/libexec/t3code -path '*/node-pty/deps' -exec rm -rf {} +
+ find $out/libexec/t3code -path '*/node-pty/src' -exec rm -rf {} +
+ find $out/libexec/t3code -path '*/node-pty/third_party' -exec rm -rf {} +
+
+ # Remove broken symlinks (workspace refs inlined by tsdown + pruned deps)
+ find $out/libexec/t3code -xtype l -delete
+
+ # Server wrapper
+ makeWrapper ${lib.getExe nodejs} $out/bin/t3code \
--add-flags "$out/libexec/t3code/apps/server/dist/index.mjs"
+ # Desktop wrapper
+ makeWrapper ${lib.getExe electron} $out/bin/t3code-desktop \
+ --add-flags "$out/libexec/t3code/apps/desktop/dist-electron/main.js" \
+ --add-flags "\''${NIXOS_OZONE_WL:+\''${WAYLAND_DISPLAY:+--ozone-platform-hint=auto --enable-features=WaylandWindowDecorations --enable-wayland-ime=true}}"
+
+ install -Dm644 assets/prod/black-universal-1024.png $out/share/icons/hicolor/1024x1024/apps/t3code.png
+
runHook postInstall
'';
@@ -151,3 +196,33 @@
+ postInstall = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) ''
+ installShellCompletion --cmd t3code \
+ --bash <($out/bin/t3code --completions bash) \
+ --zsh <($out/bin/t3code --completions zsh) \
+ --fish <($out/bin/t3code --completions fish)
+ '';
+
+ desktopItems = [
+ (makeDesktopItem {
+ name = "t3code";
+ desktopName = "T3 Code";
+ comment = finalAttrs.meta.description;
+ exec = "t3code-desktop %U";
+ terminal = false;
+ icon = "t3code";
+ startupWMClass = "t3code";
+ categories = [
+ "Development"
+ "Utility"
+ ];
+ })
+ ];
+
+ passthru.updateScript = nix-update-script {
+ extraArgs = [
+ "--subpackage"
+ "node_modules"
+ ];
+ };
+
meta = {
description = "Minimal web GUI for coding agents";
homepage = "https://github.com/pingdotgg/t3code";
@@ -154,7 +229,8 @@
license = lib.licenses.mit;
- maintainers = with lib.maintainers; [ imalison ];
+ maintainers = with lib.maintainers; [
+ imalison
+ qweered
+ ];
mainProgram = "t3code";
- platforms = lib.platforms.linux;
- sourceProvenance = with lib.sourceTypes; [ fromSource ];
};
}) |
yzhou216
left a comment
There was a problem hiding this comment.
Please edit the PR title to match the package version.
92eef9f to
24534c6
Compare
e76c961 to
d6459fe
Compare
This comment was marked as outdated.
This comment was marked as outdated.
d6459fe to
cc67fc3
Compare
|
yzhou216
left a comment
There was a problem hiding this comment.
Approved automatically following the successful run of nixpkgs-review.
This comment was marked as outdated.
This comment was marked as outdated.
de72e41 to
6227ae1
Compare
|
Addressed the latest Darwin Root causes:
Fix in
Validation:
I force-pushed the amended single-commit branch just now. |
This comment was marked as outdated.
This comment was marked as outdated.
|
Addressed the remaining Darwin Root cause:
Fix:
Validation:
|
6227ae1 to
47975cc
Compare
|
@colonelpanic8 |
is there anything outstanding? I literally can't do anything to test on darwin because i dont have a mac... |
The least you can try is to cross compile for Darwin or run OS X in QEMU. |
|
I did an actual Darwin cross-compilation attempt from Linux instead of another dry-run-only check. What I tried:
What I changed in the package while doing that:
Validation on the native path still passes:
Cross-compilation result:
So I did perform the requested cross-compilation attempt, but the current blocker is lower in the Darwin target |
47975cc to
2495b10
Compare
|
Correction on the Darwin cross-compilation debugging: the recursion is broader than After rerunning with
That fails in the Darwin cross stack at:
So with unsupported systems allowed, this machine can in fact be used to debug further, but the current blocker is a more general Darwin cross recursion in the package set rather than something specific to I’m keeping the |
|
yzhou216
left a comment
There was a problem hiding this comment.
Approved automatically following the successful run of nixpkgs-review.
2495b10 to
ea6246a
Compare
|
Addressed the April 14 review in the existing single commit and rebased onto current Changes:
Validation:
One remaining upstream quirk after removing the downstream version rewrites: Current PR head: |
| bun --bun ${./canonicalize-node-modules.ts} | ||
|
|
||
| # Rebuild .bin symlinks against the canonicalized .bun layout so the | ||
| # vendored node_modules tree keeps deterministic relative targets. |
There was a problem hiding this comment.
This is water, and it describes absolutely nothing. Please write with your own memory why you added this and what problem it solves. Also, did you at least read what I wrote?
There was a problem hiding this comment.
This change makes the hash reliable across platforms in a way it was not before. My original plan was to drop Darwin support, but @yzhou216 asked me to spend significant time trying to make it work, including attempting cross-compilation. Now the suggestion is to drop Darwin support after all.
The level of debate over very minor details on a pull request that has been in good shape for quite a while is exhausting. I am done spending more time on it. If @qweered wants to get it over the line or build their own version, they are welcome to do so.
There was a problem hiding this comment.
@yzhou216 asked me to spend significant time trying to make it work
Do you mean that the LLM you are using spent a significant time?
No offense, I think people here who have reviewed this PR also spent a significant amount of time. I'm fine with LLM usage, but it's a bit unfair that we are using manpower to review and just getting bot replies from you.
There was a problem hiding this comment.
First of all, I am sorry for what I said yesterday. I should not have said that. But I agree with @yzhou216 in some aspect, having LLM respond to someone without any of your actual effort is disrespectful
|
@t3dotgg, sorry for the ping. I'm not sure how much you care about Nix, but I'm just wondering if you would like to take a look at this. |
|
Please don't ping a busy man. It puts an unfair burden on the upstream for something that is our (as the Nix community) job. If there is genuine interest in the package, someone will step up and maintain it |
If the upstream is interested, that's great. Otherwise, we don't hear anything back, which is fine too. How would that be a burden? |
Summary
t3codepackage for pingdotgg/t3codet3codewrapper and markimalisonas maintainerTesting