Wrap T3 Code apps with optional agent CLI paths
- Split base desktop/server derivations from wrapper layers - Add optional PATH injection for codex, claudeCode, and opencode - Update flake inputs and lock entries for nixpkgs/llm-agents
This commit is contained in:
Generated
+18
-4
@@ -101,9 +101,7 @@
|
||||
"blueprint": "blueprint",
|
||||
"bun2nix": "bun2nix",
|
||||
"flake-parts": "flake-parts",
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems",
|
||||
"treefmt-nix": "treefmt-nix"
|
||||
},
|
||||
@@ -122,6 +120,22 @@
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1776949667,
|
||||
"narHash": "sha256-GMSVw35Q+294GlrTUKlx087E31z7KurReQ1YHSKp5iw=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "01fbdeef22b76df85ea168fbfe1bfd9e63681b30",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1776734388,
|
||||
"narHash": "sha256-vl3dkhlE5gzsItuHoEMVe+DlonsK+0836LIRDnm6MXQ=",
|
||||
@@ -140,7 +154,7 @@
|
||||
"root": {
|
||||
"inputs": {
|
||||
"llm-agents": "llm-agents",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"t3code": "t3code"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
|
||||
llm-agents = {
|
||||
url = "github:numtide/llm-agents.nix";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
llm-agents.url = "github:numtide/llm-agents.nix";
|
||||
t3code.url = "github:pingdotgg/t3code";
|
||||
t3code.flake = false;
|
||||
};
|
||||
|
||||
+7
-3
@@ -72,8 +72,8 @@ in {
|
||||
--backend=copyfile \
|
||||
--linker=hoisted \
|
||||
--no-progress \
|
||||
${renderBunInstallFlags installFlags}
|
||||
${renderBunFilters filters}
|
||||
${renderBunInstallFlags installFlags}
|
||||
${renderBunFilters filters}
|
||||
|
||||
bun --bun ${./scripts/canonicalize-node-modules.ts}
|
||||
bun --bun ${./scripts/normalize-bun-binaries.ts}
|
||||
@@ -109,7 +109,11 @@ ${renderBunFilters filters}
|
||||
mkdir -p ./node_modules
|
||||
cp -R ${nodeModules}/. ./node_modules/
|
||||
chmod -R u+rwX node_modules
|
||||
if [ ${if chmodBins then "true" else "false"} = true ] && [ -d node_modules/.bin ]; then
|
||||
if [ ${
|
||||
if chmodBins
|
||||
then "true"
|
||||
else "false"
|
||||
} = true ] && [ -d node_modules/.bin ]; then
|
||||
chmod -R u+x node_modules/.bin
|
||||
fi
|
||||
patchShebangs node_modules
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
export npm_config_build_from_source=true
|
||||
'';
|
||||
};
|
||||
|
||||
in {
|
||||
inherit
|
||||
t3codeNodeModulesBase
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
src,
|
||||
asar,
|
||||
stdenv,
|
||||
symlinkJoin,
|
||||
bun,
|
||||
codex ? null,
|
||||
claudeCode ? null,
|
||||
@@ -35,11 +36,7 @@
|
||||
|
||||
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: {
|
||||
basePackage = stdenv.mkDerivation (finalAttrs: {
|
||||
inherit pname version;
|
||||
inherit src;
|
||||
|
||||
@@ -181,13 +178,6 @@ in
|
||||
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
|
||||
@@ -205,4 +195,34 @@ in
|
||||
platforms = ["x86_64-linux"];
|
||||
sourceProvenance = with lib.sourceTypes; [fromSource];
|
||||
};
|
||||
})
|
||||
});
|
||||
withAgentPath = withCodex || withClaudeCode || withOpencode;
|
||||
agentPath = lib.makeBinPath (
|
||||
lib.optionals withCodex [codex]
|
||||
++ lib.optionals withClaudeCode [claudeCode]
|
||||
++ lib.optionals withOpencode [opencode]
|
||||
);
|
||||
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";
|
||||
if withAgentPath
|
||||
then
|
||||
symlinkJoin {
|
||||
inherit pname version;
|
||||
name = "${pname}-${version}";
|
||||
paths = [basePackage];
|
||||
nativeBuildInputs = [makeWrapper];
|
||||
postBuild = ''
|
||||
wrapProgram "$out/bin/t3code" \
|
||||
--prefix PATH : "${agentPath}"
|
||||
|
||||
rm -f "$out/share/applications/t3code.desktop"
|
||||
install -Dm644 ${basePackage}/share/applications/t3code.desktop \
|
||||
"$out/share/applications/t3code.desktop"
|
||||
substituteInPlace "$out/share/applications/t3code.desktop" \
|
||||
--replace-fail "${basePackage}/bin/t3code" "$out/bin/t3code"
|
||||
'';
|
||||
meta = basePackage.meta;
|
||||
}
|
||||
else basePackage
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
lib,
|
||||
src,
|
||||
stdenv,
|
||||
symlinkJoin,
|
||||
bun,
|
||||
codex ? null,
|
||||
claudeCode ? null,
|
||||
@@ -28,11 +29,7 @@
|
||||
|
||||
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: {
|
||||
basePackage = stdenv.mkDerivation (finalAttrs: {
|
||||
inherit pname version;
|
||||
inherit src;
|
||||
|
||||
@@ -116,13 +113,6 @@ 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
|
||||
@@ -136,4 +126,28 @@ in
|
||||
platforms = lib.platforms.unix;
|
||||
sourceProvenance = with lib.sourceTypes; [fromSource];
|
||||
};
|
||||
})
|
||||
});
|
||||
withAgentPath = withCodex || withClaudeCode || withOpencode;
|
||||
agentPath = lib.makeBinPath (
|
||||
lib.optionals withCodex [codex]
|
||||
++ lib.optionals withClaudeCode [claudeCode]
|
||||
++ lib.optionals withOpencode [opencode]
|
||||
);
|
||||
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";
|
||||
if withAgentPath
|
||||
then
|
||||
symlinkJoin {
|
||||
inherit pname version;
|
||||
name = "${pname}-${version}";
|
||||
paths = [basePackage];
|
||||
nativeBuildInputs = [makeBinaryWrapper];
|
||||
postBuild = ''
|
||||
wrapProgram "$out/bin/t3" \
|
||||
--prefix PATH : "${agentPath}"
|
||||
'';
|
||||
meta = basePackage.meta;
|
||||
}
|
||||
else basePackage
|
||||
|
||||
Reference in New Issue
Block a user