add t3code

This commit is contained in:
jackjohn7 2026-04-03 00:48:29 -05:00
parent cb21e02ac7
commit 02c94fa838
4 changed files with 265 additions and 3 deletions

115
flake.lock generated
View file

@ -34,6 +34,30 @@
"type": "github" "type": "github"
} }
}, },
"bun2nix": {
"inputs": {
"flake-parts": "flake-parts",
"import-tree": "import-tree",
"nixpkgs": [
"nixpkgs"
],
"systems": "systems",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1770895533,
"narHash": "sha256-v3QaK9ugy9bN9RXDnjw0i2OifKmz2NnKM82agtqm/UY=",
"owner": "nix-community",
"repo": "bun2nix",
"rev": "c843f477b15f51151f8c6bcc886954699440a6e1",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "bun2nix",
"type": "github"
}
},
"curl-src": { "curl-src": {
"flake": false, "flake": false,
"locked": { "locked": {
@ -55,6 +79,24 @@
"inputs": { "inputs": {
"nixpkgs-lib": "nixpkgs-lib" "nixpkgs-lib": "nixpkgs-lib"
}, },
"locked": {
"lastModified": 1769996383,
"narHash": "sha256-AnYjnFWgS49RlqX7LrC4uA+sCCDBj0Ry/WOJ5XWAsa0=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "57928607ea566b5db3ad13af0e57e921e6b12381",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib_2"
},
"locked": { "locked": {
"lastModified": 1772408722, "lastModified": 1772408722,
"narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=", "narHash": "sha256-rHuJtdcOjK7rAHpHphUb1iCvgkU3GpfvicLMwwnfMT0=",
@ -109,6 +151,21 @@
} }
}, },
"import-tree": { "import-tree": {
"locked": {
"lastModified": 1763762820,
"narHash": "sha256-ZvYKbFib3AEwiNMLsejb/CWs/OL/srFQ8AogkebEPF0=",
"owner": "vic",
"repo": "import-tree",
"rev": "3c23749d8013ec6daa1d7255057590e9ca726646",
"type": "github"
},
"original": {
"owner": "vic",
"repo": "import-tree",
"type": "github"
}
},
"import-tree_2": {
"locked": { "locked": {
"lastModified": 1773693634, "lastModified": 1773693634,
"narHash": "sha256-BtZ2dtkBdSUnFPPFc+n0kcMbgaTxzFNPv2iaO326Ffg=", "narHash": "sha256-BtZ2dtkBdSUnFPPFc+n0kcMbgaTxzFNPv2iaO326Ffg=",
@ -352,6 +409,21 @@
} }
}, },
"nixpkgs-lib": { "nixpkgs-lib": {
"locked": {
"lastModified": 1769909678,
"narHash": "sha256-cBEymOf4/o3FD5AZnzC3J9hLbiZ+QDT/KDuyHXVJOpM=",
"owner": "nix-community",
"repo": "nixpkgs.lib",
"rev": "72716169fe93074c333e8d0173151350670b824c",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "nixpkgs.lib",
"type": "github"
}
},
"nixpkgs-lib_2": {
"locked": { "locked": {
"lastModified": 1772328832, "lastModified": 1772328832,
"narHash": "sha256-e+/T/pmEkLP6BHhYjx6GmwP5ivonQQn0bJdH9YrRB+Q=", "narHash": "sha256-e+/T/pmEkLP6BHhYjx6GmwP5ivonQQn0bJdH9YrRB+Q=",
@ -401,9 +473,10 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-parts": "flake-parts", "bun2nix": "bun2nix",
"flake-parts": "flake-parts_2",
"hjem": "hjem", "hjem": "hjem",
"import-tree": "import-tree", "import-tree": "import-tree_2",
"millennium": "millennium", "millennium": "millennium",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"wrapper-modules": "wrapper-modules" "wrapper-modules": "wrapper-modules"
@ -438,7 +511,7 @@
"nixpkgs" "nixpkgs"
], ],
"rust-overlay": "rust-overlay", "rust-overlay": "rust-overlay",
"systems": "systems" "systems": "systems_2"
}, },
"locked": { "locked": {
"lastModified": 1771208268, "lastModified": 1771208268,
@ -469,6 +542,42 @@
"type": "github" "type": "github"
} }
}, },
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"bun2nix",
"nixpkgs"
]
},
"locked": {
"lastModified": 1770228511,
"narHash": "sha256-wQ6NJSuFqAEmIg2VMnLdCnUc0b7vslUohqqGGD+Fyxk=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "337a4fe074be1042a35086f15481d763b8ddc0e7",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"websocketpp-src": { "websocketpp-src": {
"flake": false, "flake": false,
"locked": { "locked": {

View file

@ -16,6 +16,9 @@
url = "github:SteamClientHomebrew/Millennium?dir=packages/nix"; url = "github:SteamClientHomebrew/Millennium?dir=packages/nix";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
bun2nix.url = "github:nix-community/bun2nix";
bun2nix.inputs.nixpkgs.follows = "nixpkgs";
}; };
outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules); outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } (inputs.import-tree ./modules);

View file

@ -14,6 +14,7 @@
htop htop
dbeaver-bin dbeaver-bin
self.packages.${pkgs.stdenv.hostPlatform.system}.ralph self.packages.${pkgs.stdenv.hostPlatform.system}.ralph
self.packages.${pkgs.stdenv.hostPlatform.system}.t3code
]; ];
programs.zoxide = { programs.zoxide = {
enable = true; enable = true;

View file

@ -0,0 +1,149 @@
{ self, inputs, ... }:
{
perSystem =
{
pkgs,
lib,
system,
...
}:
let
version = "2026-04-02";
src = pkgs.fetchFromGitHub {
owner = "coygeek";
repo = "2026-03-31-t3-opencode";
rev = "24a542c6f8731476f333298662f273c164ff2446";
hash = "sha256-Z4BhkHdH9iEW45lstyklKwzQ1/qDXNJN8pdXlfoZYaY=";
};
nodeModules = pkgs.stdenvNoCC.mkDerivation {
pname = "t3code-node_modules";
inherit version 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-YVoHCTiufVFc3G2kJT2Li+JSnht54ZgtjtnJdsfrgO0=";
outputHashAlgo = "sha256";
outputHashMode = "recursive";
};
in
{
packages.t3code = pkgs.stdenv.mkDerivation {
pname = "t3code";
inherit version 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
'';
meta = {
description = "T3 Code with OpenCode";
homepage = "https://t3.codes";
license = lib.licenses.mit;
mainProgram = "t3";
};
};
};
}