diff --git a/flake.lock b/flake.lock index 5763c53..f31b889 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,126 @@ { "nodes": { + "blueprint": { + "inputs": { + "nixpkgs": [ + "llm-agents", + "nixpkgs" + ], + "systems": [ + "llm-agents", + "systems" + ] + }, + "locked": { + "lastModified": 1776249299, + "narHash": "sha256-Dt9t1TGRmJFc0xVYhttNBD6QsAgHOHCArqGa0AyjrJY=", + "owner": "numtide", + "repo": "blueprint", + "rev": "56131e8628f173d24a27f6d27c0215eff57e40dd", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "blueprint", + "type": "github" + } + }, + "bun2nix": { + "inputs": { + "flake-parts": [ + "llm-agents", + "flake-parts" + ], + "import-tree": "import-tree", + "nixpkgs": [ + "llm-agents", + "nixpkgs" + ], + "systems": [ + "llm-agents", + "systems" + ], + "treefmt-nix": [ + "llm-agents", + "treefmt-nix" + ] + }, + "locked": { + "lastModified": 1777322186, + "narHash": "sha256-CFlRnym0RphrTymMUg7PfQgfdYdMd6BnMZQJhlwv0fI=", + "owner": "nix-community", + "repo": "bun2nix", + "rev": "8985e47786dd0bfa95b7c795f12aeafadd328eb8", + "type": "github" + }, + "original": { + "owner": "nix-community", + "ref": "staging-2.1.0", + "repo": "bun2nix", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "llm-agents", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775087534, + "narHash": "sha256-91qqW8lhL7TLwgQWijoGBbiD4t7/q75KTi8NxjVmSmA=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "3107b77cd68437b9a76194f0f7f9c55f2329ca5b", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "import-tree": { + "locked": { + "lastModified": 1773693634, + "narHash": "sha256-BtZ2dtkBdSUnFPPFc+n0kcMbgaTxzFNPv2iaO326Ffg=", + "owner": "vic", + "repo": "import-tree", + "rev": "c41e7d58045f9057880b0d85e1152d6a4430dbf1", + "type": "github" + }, + "original": { + "owner": "vic", + "repo": "import-tree", + "type": "github" + } + }, + "llm-agents": { + "inputs": { + "blueprint": "blueprint", + "bun2nix": "bun2nix", + "flake-parts": "flake-parts", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1777354680, + "narHash": "sha256-jtMZ7U79JYGoE8NYIu8Y4bNr+EoQW5i6zMP6Mig7tCU=", + "owner": "numtide", + "repo": "llm-agents.nix", + "rev": "efa749415e2ee5015db3fda1d3d6d7484d8aa64c", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "llm-agents.nix", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1776734388, @@ -18,10 +139,26 @@ }, "root": { "inputs": { + "llm-agents": "llm-agents", "nixpkgs": "nixpkgs", "t3code": "t3code" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "t3code": { "flake": false, "locked": { @@ -37,6 +174,27 @@ "repo": "t3code", "type": "github" } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "llm-agents", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1775636079, + "narHash": "sha256-pc20NRoMdiar8oPQceQT47UUZMBTiMdUuWrYu2obUP0=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "790751ff7fd3801feeaf96d7dc416a8d581265ba", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 6f0b2a4..06e6bf6 100644 --- a/flake.nix +++ b/flake.nix @@ -3,12 +3,17 @@ inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; + llm-agents = { + url = "github:numtide/llm-agents.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; t3code.url = "github:pingdotgg/t3code"; t3code.flake = false; }; outputs = { self, + llm-agents, nixpkgs, t3code, ... @@ -25,8 +30,18 @@ packages = forAllSystems ( system: let pkgs = import nixpkgs {inherit system;}; - t3code-desktop = pkgs.callPackage ./packages/t3code-desktop {src = t3code;}; - t3code-server = pkgs.callPackage ./packages/t3code-server {src = t3code;}; + t3code-desktop = pkgs.callPackage ./packages/t3code-desktop { + src = t3code; + 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 { + src = t3code; + codex = llm-agents.packages.${system}.codex; + claudeCode = llm-agents.packages.${system}."claude-code"; + opencode = llm-agents.packages.${system}.opencode; + }; in { inherit t3code-desktop t3code-server; desktop = t3code-desktop; diff --git a/packages/t3code-desktop/default.nix b/packages/t3code-desktop/default.nix index 2a9024d..a5a344a 100644 --- a/packages/t3code-desktop/default.nix +++ b/packages/t3code-desktop/default.nix @@ -4,6 +4,8 @@ asar, stdenv, bun, + codex ? null, + claudeCode ? null, electron_40, gcc, git, @@ -11,9 +13,13 @@ makeWrapper, node-gyp, nodejs, + opencode ? null, pkg-config, python3, writableTmpDirAsHomeHook, + withClaudeCode ? false, + withCodex ? false, + withOpencode ? false, xdg-utils, }: let common = import ../common.nix { @@ -30,6 +36,9 @@ pname = "t3code-desktop"; version = desktopPackageJson.version; in + assert lib.assertMsg (!withCodex || codex != null) "withCodex requires a codex package"; + assert lib.assertMsg (!withClaudeCode || claudeCode != null) "withClaudeCode requires a claudeCode package"; + assert lib.assertMsg (!withOpencode || opencode != null) "withOpencode requires an opencode package"; stdenv.mkDerivation (finalAttrs: { inherit pname version; inherit src; @@ -169,9 +178,16 @@ in --set-default ELECTRON_FORCE_IS_PACKAGED 1 \ --set-default ELECTRON_IS_DEV 0 \ --prefix PATH : ${lib.makeBinPath [ - git - xdg-utils - ]} \ + git + xdg-utils + ]} \ + ${lib.optionalString withCodex '' + --prefix PATH : "${lib.makeBinPath [ codex ]}" \ + ''}${lib.optionalString withClaudeCode '' + --prefix PATH : "${lib.makeBinPath [ claudeCode ]}" \ + ''}${lib.optionalString withOpencode '' + --prefix PATH : "${lib.makeBinPath [ opencode ]}" \ + ''} \ --add-flags "$out/share/${pname}/resources/app.asar" export out diff --git a/packages/t3code-server/default.nix b/packages/t3code-server/default.nix index a6b0674..5dc891b 100644 --- a/packages/t3code-server/default.nix +++ b/packages/t3code-server/default.nix @@ -3,11 +3,17 @@ src, stdenv, bun, + codex ? null, + claudeCode ? null, makeBinaryWrapper, node-gyp, nodejs, + opencode ? null, python3, writableTmpDirAsHomeHook, + withClaudeCode ? false, + withCodex ? false, + withOpencode ? false, }: let common = import ../common.nix { inherit @@ -23,6 +29,9 @@ pname = "t3code-server"; version = serverPackageJson.version; in + assert lib.assertMsg (!withCodex || codex != null) "withCodex requires a codex package"; + assert lib.assertMsg (!withClaudeCode || claudeCode != null) "withClaudeCode requires a claudeCode package"; + assert lib.assertMsg (!withOpencode || opencode != null) "withOpencode requires an opencode package"; stdenv.mkDerivation (finalAttrs: { inherit pname version; inherit src; @@ -107,6 +116,13 @@ in cp -R --no-preserve=mode packages/shared "$out/libexec/t3code/packages/" makeWrapper ${lib.getExe nodejs} "$out/bin/t3" \ + ${lib.optionalString withCodex '' + --prefix PATH : "${lib.makeBinPath [ codex ]}" \ + ''}${lib.optionalString withClaudeCode '' + --prefix PATH : "${lib.makeBinPath [ claudeCode ]}" \ + ''}${lib.optionalString withOpencode '' + --prefix PATH : "${lib.makeBinPath [ opencode ]}" \ + ''} \ --add-flags "$out/libexec/t3code/apps/server/dist/bin.mjs" runHook postInstall