Files
nixos-config/pkgs/t3-code/package.nix
T
Miguel Palhas 938a900fbe feat(home): package Claude Desktop and T3 Code, with per-host UI scaling
Add two Electron AI desktop apps built from their official upstream
binaries and wire them into the home config (x86_64 only):

- claude-desktop: Anthropic's official Linux .deb, unpacked via dpkg +
  autoPatchelfHook. Wrapper disables the SUID sandbox (nix store can't
  set it up) and adds the NixOS GL driver path so it hardware-accelerates
  instead of falling back to software rendering.
- t3-code: pingdotgg/t3code AppImage via appimageTools.wrapType2, with
  desktop entry + hicolor icons.

Both share a new custom.aiApps.deviceScaleFactor option feeding
--force-device-scale-factor; konishi's 4K@1x monitors set it to "1.5",
arrakis stays native.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-16 14:06:55 +01:00

42 lines
1.5 KiB
Nix

{
lib,
appimageTools,
fetchurl,
# UI scaling: null = native, or a string like "1.5" for --force-device-scale-factor.
deviceScaleFactor ? null,
}:
let
pname = "t3-code";
version = "0.0.28";
# T3 Code (pingdotgg/t3code): open-source control plane for coding agents.
# Ships only an x86_64 AppImage; bump version + hash from the releases page:
# https://github.com/pingdotgg/t3code/releases
src = fetchurl {
url = "https://github.com/pingdotgg/t3code/releases/download/v${version}/T3-Code-${version}-x86_64.AppImage";
hash = "sha256-+mBp+wPrJRV/HpaimQHcqBuwqZcPWTbKJVNCVW7ELgo=";
};
appimageContents = appimageTools.extract { inherit pname version src; };
in
appimageTools.wrapType2 {
inherit pname version src;
extraInstallCommands = ''
# Desktop entry + icons from the AppImage, repointed at the wrapped binary.
install -Dm444 ${appimageContents}/t3code.desktop $out/share/applications/t3code.desktop
substituteInPlace $out/share/applications/t3code.desktop \
--replace-fail "Exec=AppRun --no-sandbox" "Exec=${pname} --no-sandbox${lib.optionalString (deviceScaleFactor != null) " --force-device-scale-factor=${deviceScaleFactor}"}"
cp -r ${appimageContents}/usr/share/icons $out/share/icons
'';
meta = {
description = "Open-source control plane for coding agents (Claude Code, Codex, OpenCode, Cursor)";
homepage = "https://t3.codes";
license = lib.licenses.mit;
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
platforms = [ "x86_64-linux" ];
mainProgram = "t3-code";
};
}