mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-24 04:01:10 -04:00
47d3e7ef9a
- Rename packages/opencode to packages/agent-core - Update bin entry from opencode to agent-core - Set default_agent to "zee" for persona-first UX - Update terminal title to show current persona name - Fix persona colors: - Zee: #2563EB (blue) - Stanley: #059669 (emerald green) - Johny: #DC2626 (red) - Update all documentation and build script references - Update root package.json name and dev script Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
98 lines
2.2 KiB
Nix
98 lines
2.2 KiB
Nix
{
|
|
lib,
|
|
stdenvNoCC,
|
|
callPackage,
|
|
bun,
|
|
sysctl,
|
|
makeBinaryWrapper,
|
|
models-dev,
|
|
ripgrep,
|
|
installShellFiles,
|
|
versionCheckHook,
|
|
writableTmpDirAsHomeHook,
|
|
node_modules ? callPackage ./node-modules.nix { },
|
|
}:
|
|
stdenvNoCC.mkDerivation (finalAttrs: {
|
|
pname = "agent-core";
|
|
inherit (node_modules) version src;
|
|
inherit node_modules;
|
|
|
|
nativeBuildInputs = [
|
|
bun
|
|
installShellFiles
|
|
makeBinaryWrapper
|
|
models-dev
|
|
writableTmpDirAsHomeHook
|
|
];
|
|
|
|
configurePhase = ''
|
|
runHook preConfigure
|
|
|
|
cp -R ${finalAttrs.node_modules}/. .
|
|
|
|
runHook postConfigure
|
|
'';
|
|
|
|
env.MODELS_DEV_API_JSON = "${models-dev}/dist/_api.json";
|
|
env.OPENCODE_VERSION = finalAttrs.version;
|
|
env.OPENCODE_CHANNEL = "local";
|
|
|
|
buildPhase = ''
|
|
runHook preBuild
|
|
|
|
cd ./packages/agent-core
|
|
bun --bun ./script/build.ts --single --skip-install
|
|
bun --bun ./script/schema.ts schema.json
|
|
|
|
runHook postBuild
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
cd packages/agent-core
|
|
install -Dm755 dist/agent-core-*/bin/opencode $out/bin/agent-core
|
|
install -Dm644 schema.json $out/share/agent-core/schema.json
|
|
|
|
wrapProgram $out/bin/agent-core \
|
|
--prefix PATH : ${
|
|
lib.makeBinPath (
|
|
[
|
|
ripgrep
|
|
]
|
|
# bun runs sysctl to detect if dunning on rosetta2
|
|
++ lib.optional stdenvNoCC.hostPlatform.isDarwin sysctl
|
|
)
|
|
}
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
postInstall = lib.optionalString (stdenvNoCC.buildPlatform.canExecute stdenvNoCC.hostPlatform) ''
|
|
# trick yargs into also generating zsh completions
|
|
installShellCompletion --cmd agent-core \
|
|
--bash <($out/bin/agent-core completion) \
|
|
--zsh <(SHELL=/bin/zsh $out/bin/agent-core completion)
|
|
'';
|
|
|
|
nativeInstallCheckInputs = [
|
|
versionCheckHook
|
|
writableTmpDirAsHomeHook
|
|
];
|
|
doInstallCheck = true;
|
|
versionCheckKeepEnvironment = [ "HOME" ];
|
|
versionCheckProgramArg = "--version";
|
|
|
|
passthru = {
|
|
jsonschema = "${placeholder "out"}/share/agent-core/schema.json";
|
|
};
|
|
|
|
meta = {
|
|
description = "The open source coding agent";
|
|
homepage = "https://opencode.ai/";
|
|
license = lib.licenses.mit;
|
|
mainProgram = "agent-core";
|
|
inherit (node_modules.meta) platforms;
|
|
};
|
|
})
|