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:
@@ -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;
|
||||
|
||||
@@ -178,16 +175,9 @@ in
|
||||
--set-default ELECTRON_FORCE_IS_PACKAGED 1 \
|
||||
--set-default ELECTRON_IS_DEV 0 \
|
||||
--prefix PATH : ${lib.makeBinPath [
|
||||
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 ]}" \
|
||||
''} \
|
||||
git
|
||||
xdg-utils
|
||||
]} \
|
||||
--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
|
||||
|
||||
Reference in New Issue
Block a user