Skip to content

Created a nix flake of t3code #347

Description

@Sawrz

As a Nixos user, I wanted this lovely application to work nicely on my system. It was important to me to be able to make it declarative. Hence, I created a flake to make this possible. I'm still ironing things out but I was able to install the desktop version (AppImage) on my system and make it discoverable with launchers. I'm still working on the t3 (local browser) version and I want be able to provide it on arm as well for darwin-nix users.

Here is the link: https://github.com/Sawrz/t3code-nix

@t3dotgg @juliusmarminge If you want to provide the flake by yourself and maintain it, I don't mind and would transfer the repo to you guys. The only thing I care, is to use this lovely application on my system =)

Thank you for making t3code open-source and allowing other developers increasing their productivity. Today is like christmas and I'm five again!

Activity

  1. jakob1379 commented on Apr 2, 2026

    @jakob1379
    Contributor

    I mashed this together and have been using it without issue for about a month. I never noticed there should be a desktop version as I only really care for web-based apps for remote hosting :)

    Original snippet clone repo and add the flake there,
    {
      inputs = {
        nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
      };
    
      outputs =
        { nixpkgs, ... }:
        let
          lib = nixpkgs.lib;
          systems = [
            "x86_64-linux"
            "aarch64-linux"
            "x86_64-darwin"
            "aarch64-darwin"
          ];
          forAllSystems = lib.genAttrs systems;
          version = "0.0.15";
          mkT3code =
            pkgs:
            let
              src = pkgs.fetchFromGitHub {
                owner = "pingdotgg";
                repo = "t3code";
                rev = "f82bae16680206e4be20baf3d835941aa68611cf";
                hash = "sha256-HOPiA8X/FzswKGmOuYKog3YIn5iq5rJ/7kDoGhN11x0=";
              };
              nodeModules = pkgs.stdenvNoCC.mkDerivation {
                pname = "t3code-node_modules";
                inherit version;
                inherit src;
    
                strictDeps = true;
    
                nativeBuildInputs = [
                  pkgs.bun
                  pkgs.nodejs
                  pkgs.writableTmpDirAsHomeHook
                ];
    
                dontConfigure = true;
                dontFixup = true;
    
                postPatch = ''
                  for packageJson in \
                    packages/contracts/package.json \
                    packages/shared/package.json
                  do
                    substituteInPlace "$packageJson" \
                      --replace-fail '"prepare": "effect-language-service patch",' '"prepare": "true",'
                  done
                '';
    
                buildPhase = ''
                  runHook preBuild
    
                  bun install \
                    --ignore-scripts \
                    --no-progress \
                    --frozen-lockfile \
                    --filter ./apps/server \
                    --filter ./apps/web \
                    --filter ./packages/contracts \
                    --filter ./packages/shared
    
                  runHook postBuild
                '';
    
                installPhase = ''
                  runHook preInstall
    
                  mkdir -p "$out"
                  find . -type d -name node_modules -exec cp -R --parents {} "$out" \;
    
                  runHook postInstall
                '';
    
                outputHash = "sha256-cOI7vID7tqLQMUJ2iUH4fOQI2EBZwu8T3tax6Y3UTkQ=";
                outputHashAlgo = "sha256";
                outputHashMode = "recursive";
              };
            in
            pkgs.stdenv.mkDerivation {
              pname = "t3code";
              inherit version;
              inherit src;
    
              strictDeps = true;
    
              nativeBuildInputs = [
                pkgs.bun
                pkgs.makeBinaryWrapper
                pkgs.node-gyp
                pkgs.nodejs
                pkgs.python3
                pkgs.writableTmpDirAsHomeHook
              ];
    
              configurePhase = ''
                runHook preConfigure
    
                cp -R ${nodeModules}/. .
    
                chmod -R u+rwX node_modules
                patchShebangs node_modules
    
                cd node_modules/.bun/node-pty@*/node_modules/node-pty
                node-gyp rebuild
                node scripts/post-install.js
                cd "$NIX_BUILD_TOP/$sourceRoot"
    
                runHook postConfigure
              '';
    
              buildPhase = ''
                runHook preBuild
    
                bun run --cwd apps/web build
                bun run --cwd apps/server build
    
                runHook postBuild
              '';
    
              installPhase = ''
                runHook preInstall
    
                mkdir -p "$out/libexec/t3code/apps/server"
                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/"
    
                rm -f \
                  "$out/libexec/t3code/apps/server/node_modules/@t3tools/contracts" \
                  "$out/libexec/t3code/apps/server/node_modules/@t3tools/shared" \
                  "$out/libexec/t3code/apps/server/node_modules/@t3tools/web"
    
                for wsDir in "$out"/libexec/t3code/node_modules/.bun/ws@*/node_modules/ws; do
                  ln -s "$wsDir" "$out/libexec/t3code/apps/server/node_modules/ws"
                  break
                done
    
                makeWrapper ${lib.getExe pkgs.nodejs} "$out/bin/t3" \
                  --add-flags "$out/libexec/t3code/apps/server/dist/index.mjs"
    
                runHook postInstall
              '';
            };
        in
        {
          packages = forAllSystems (
            system:
            let
              pkgs = import nixpkgs { inherit system; };
            in
            {
              t3code = mkT3code pkgs;
            }
          );
        };
    }

    I then made an alternative flake, just to experiment which I try to add options to enable more binaries like gitlab, jujutsu etc. using options:
    https://github.com/jakob1379/t3code-flake

    t3code.override {
        enableClaude = true;
        enableJujutsu = true;
        enableAzureDevOps = true;
      }
  2. daef commented on May 13, 2026

    @daef

    bump to 0.23: flake.nix

    slight changes required due to updated project structure...:

    17c17
    <       version = "0.0.15";
    ---
    >       version = "0.0.23";
    24,25c24,25
    <             rev = "f82bae16680206e4be20baf3d835941aa68611cf";
    <             hash = "sha256-HOPiA8X/FzswKGmOuYKog3YIn5iq5rJ/7kDoGhN11x0=";
    ---
    >             rev = "3c32bc8fd1f5970e65988e36937cb8e2921437f9";
    >             hash = "sha256-gsDHogGnzKVwypGwK1PzYBXpBYBFQHIbXMpWVUGzKU8=";
    44,50c44,45
    <               for packageJson in \
    <                 packages/contracts/package.json \
    <                 packages/shared/package.json
    <               do
    <                 substituteInPlace "$packageJson" \
    <                   --replace-fail '"prepare": "effect-language-service patch",' '"prepare": "true",'
    <               done
    ---
    >               substituteInPlace package.json \
    >                 --replace-fail '"prepare": "effect-language-service patch",' '"prepare": "true",'
    77c72
    <             outputHash = "sha256-cOI7vID7tqLQMUJ2iUH4fOQI2EBZwu8T3tax6Y3UTkQ=";
    ---
    >             outputHash = "sha256-svScvB0DghRgueH7PiwF4ML9PBcFRyWQpeNz/odJSZY=";
    133c128,131
    <               "$out/libexec/t3code/apps/server/node_modules/@t3tools/web"
    ---
    >               "$out/libexec/t3code/apps/server/node_modules/@t3tools/tailscale" \
    >               "$out/libexec/t3code/apps/server/node_modules/@t3tools/web" \
    >               "$out/libexec/t3code/apps/server/node_modules/effect-acp" \
    >               "$out/libexec/t3code/apps/server/node_modules/effect-codex-app-server"
    141c139
    <               --add-flags "$out/libexec/t3code/apps/server/dist/index.mjs"
    ---
    >               --add-flags "$out/libexec/t3code/apps/server/dist/bin.mjs"
    
  3. jakob1379 commented on May 14, 2026

    @jakob1379
    Contributor

    @daef its patched in both flake repos :)

  4. locked and limited conversation to collaborators on Aug 15, 2026
  5. converted this issue into a discussion #7057 on Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions