Compare commits

..

3 Commits

Author SHA1 Message Date
unexplrd 6431c515df Update common.nix 2026-05-11 13:52:09 +03:00
unexplrd 6763181b94 Update README.md 2026-04-28 15:47:17 +03:00
unexplrd 4aee7480c7 Refactor flake.nix, add Package suffix to cli package args 2026-04-28 15:47:06 +03:00
5 changed files with 60 additions and 50 deletions
+21 -11
View File
@@ -19,8 +19,16 @@ For each supported system, the flake exports:
Current `default` points to the `t3code-desktop`. Current `default` points to the `t3code-desktop`.
There are also `desktop` and `server` shorthands available for `apps` and `packages`.
## Usage ## Usage
Inspect the flake surface:
```bash
nix flake show --all-systems
```
Build the desktop package: Build the desktop package:
```bash ```bash
@@ -53,24 +61,26 @@ Both packages can be overridden to add AI agent CLIs to the runtime `PATH`:
- `withClaudeCode` adds `github:numtide/llm-agents.nix#claude-code` - `withClaudeCode` adds `github:numtide/llm-agents.nix#claude-code`
- `withOpencode` adds `github:numtide/llm-agents.nix#opencode` - `withOpencode` adds `github:numtide/llm-agents.nix#opencode`
Agent CLIs can be overridden as well using `codexPackage`, `claudeCodePackage` and `opencodePackage` respectively.
These overrides wrap the finished package in a small `postBuild` layer, so changing the agent flags does not rebuild the full T3 Code package. These overrides wrap the finished package in a small `postBuild` layer, so changing the agent flags does not rebuild the full T3 Code package.
In a Nix expression, use the same package override directly: In a Nix expression, use the same package override directly (using `perSystem` from [`github:numtide/blueprint`](https://github.com/numtide/blueprint)):
```nix ```nix
self.packages.${system}.t3code-desktop.override { {perSystem, pkgs, ...}: {
withCodex = true; home.packages = [
withClaudeCode = true; (perSystem.t3code.desktop.override {
withOpencode = true; withCodex = true;
claudeCodePackage = pkgs.claude-code-bin;
withClaudeCode = true;
opencodePackage = perSystem.foobar.my-awesome-opencode-fork;
withOpencode = true;
})
];
} }
``` ```
Inspect the flake surface:
```bash
nix flake show --all-systems
```
## Layout ## Layout
```text ```text
+6 -8
View File
@@ -32,17 +32,15 @@
packages = forAllSystems ( packages = forAllSystems (
system: let system: let
pkgs = import nixpkgs {inherit system;}; pkgs = import nixpkgs {inherit system;};
src = t3code;
codexPackage = llm-agents.packages.${system}.codex;
claudeCodePackage = llm-agents.packages.${system}."claude-code";
opencodePackage = llm-agents.packages.${system}.opencode;
t3code-desktop = pkgs.callPackage ./packages/t3code-desktop { t3code-desktop = pkgs.callPackage ./packages/t3code-desktop {
src = t3code; inherit src codexPackage claudeCodePackage opencodePackage;
codex = llm-agents.packages.${system}.codex;
claudeCode = llm-agents.packages.${system}."claude-code";
opencode = llm-agents.packages.${system}.opencode;
}; };
t3code-server = pkgs.callPackage ./packages/t3code-server { t3code-server = pkgs.callPackage ./packages/t3code-server {
src = t3code; inherit src codexPackage claudeCodePackage opencodePackage;
codex = llm-agents.packages.${system}.codex;
claudeCode = llm-agents.packages.${system}."claude-code";
opencode = llm-agents.packages.${system}.opencode;
}; };
in { in {
inherit t3code-desktop t3code-server; inherit t3code-desktop t3code-server;
+15 -13
View File
@@ -15,11 +15,11 @@
"packages/shared/package.json" "packages/shared/package.json"
]; ];
renderBunFilters = filters: renderBunInstallArgs = flags: filters:
lib.concatMapStringsSep "\n" (filter: " --filter ${filter} \\") filters; lib.concatMapStringsSep "\n" (arg: " bunInstallArgs+=(${lib.escapeShellArg arg})") (
flags
renderBunInstallFlags = flags: ++ lib.concatMap (filter: ["--filter" filter]) filters
lib.concatMapStringsSep "\n" (flag: " ${flag} \\") flags; );
in { in {
inherit workspacePreparePatched; inherit workspacePreparePatched;
@@ -66,14 +66,16 @@ in {
export BUN_INSTALL_CACHE_DIR="$(mktemp -d)" export BUN_INSTALL_CACHE_DIR="$(mktemp -d)"
${extraEnv} ${extraEnv}
bun install \ bunInstallArgs=(
--frozen-lockfile \ --frozen-lockfile
--ignore-scripts \ --ignore-scripts
--backend=copyfile \ --backend=copyfile
--linker=hoisted \ --linker=hoisted
--no-progress \ --no-progress
${renderBunInstallFlags installFlags} )
${renderBunFilters filters} ${renderBunInstallArgs installFlags filters}
bun install "''${bunInstallArgs[@]}"
bun --bun ${./scripts/canonicalize-node-modules.ts} bun --bun ${./scripts/canonicalize-node-modules.ts}
bun --bun ${./scripts/normalize-bun-binaries.ts} bun --bun ${./scripts/normalize-bun-binaries.ts}
+9 -9
View File
@@ -5,8 +5,8 @@
stdenv, stdenv,
symlinkJoin, symlinkJoin,
bun, bun,
codex ? null, codexPackage ? null,
claudeCode ? null, claudeCodePackage ? null,
electron_40, electron_40,
gcc, gcc,
git, git,
@@ -14,7 +14,7 @@
makeWrapper, makeWrapper,
node-gyp, node-gyp,
nodejs, nodejs,
opencode ? null, opencodePackage ? null,
pkg-config, pkg-config,
python3, python3,
writableTmpDirAsHomeHook, writableTmpDirAsHomeHook,
@@ -198,14 +198,14 @@
}); });
withAgentPath = withCodex || withClaudeCode || withOpencode; withAgentPath = withCodex || withClaudeCode || withOpencode;
agentPath = lib.makeBinPath ( agentPath = lib.makeBinPath (
lib.optionals withCodex [codex] lib.optionals withCodex [codexPackage]
++ lib.optionals withClaudeCode [claudeCode] ++ lib.optionals withClaudeCode [claudeCodePackage]
++ lib.optionals withOpencode [opencode] ++ lib.optionals withOpencode [opencodePackage]
); );
in in
assert lib.assertMsg (!withCodex || codex != null) "withCodex requires a codex package"; assert lib.assertMsg (!withCodex || codexPackage != null) "withCodex requires a codex package";
assert lib.assertMsg (!withClaudeCode || claudeCode != null) "withClaudeCode requires a claudeCode package"; assert lib.assertMsg (!withClaudeCode || claudeCodePackage != null) "withClaudeCode requires a claudeCode package";
assert lib.assertMsg (!withOpencode || opencode != null) "withOpencode requires an opencode package"; assert lib.assertMsg (!withOpencode || opencodePackage != null) "withOpencode requires an opencode package";
if withAgentPath if withAgentPath
then then
symlinkJoin { symlinkJoin {
+9 -9
View File
@@ -4,12 +4,12 @@
stdenv, stdenv,
symlinkJoin, symlinkJoin,
bun, bun,
codex ? null, codexPackage ? null,
claudeCode ? null, claudeCodePackage ? null,
makeBinaryWrapper, makeBinaryWrapper,
node-gyp, node-gyp,
nodejs, nodejs,
opencode ? null, opencodePackage ? null,
python3, python3,
writableTmpDirAsHomeHook, writableTmpDirAsHomeHook,
withClaudeCode ? false, withClaudeCode ? false,
@@ -129,14 +129,14 @@
}); });
withAgentPath = withCodex || withClaudeCode || withOpencode; withAgentPath = withCodex || withClaudeCode || withOpencode;
agentPath = lib.makeBinPath ( agentPath = lib.makeBinPath (
lib.optionals withCodex [codex] lib.optionals withCodex [codexPackage]
++ lib.optionals withClaudeCode [claudeCode] ++ lib.optionals withClaudeCode [claudeCodePackage]
++ lib.optionals withOpencode [opencode] ++ lib.optionals withOpencode [opencodePackage]
); );
in in
assert lib.assertMsg (!withCodex || codex != null) "withCodex requires a codex package"; assert lib.assertMsg (!withCodex || codexPackage != null) "withCodex requires a codex package";
assert lib.assertMsg (!withClaudeCode || claudeCode != null) "withClaudeCode requires a claudeCode package"; assert lib.assertMsg (!withClaudeCode || claudeCodePackage != null) "withClaudeCode requires a claudeCode package";
assert lib.assertMsg (!withOpencode || opencode != null) "withOpencode requires an opencode package"; assert lib.assertMsg (!withOpencode || opencodePackage != null) "withOpencode requires an opencode package";
if withAgentPath if withAgentPath
then then
symlinkJoin { symlinkJoin {