kilo: init at 7.3.40; kilocode-cli: drop package (#515146)
This commit is contained in:
@@ -0,0 +1,200 @@
|
||||
{
|
||||
lib,
|
||||
stdenvNoCC,
|
||||
bun,
|
||||
fetchFromGitHub,
|
||||
installShellFiles,
|
||||
makeBinaryWrapper,
|
||||
models-dev,
|
||||
nix-update-script,
|
||||
ripgrep,
|
||||
sysctl,
|
||||
versionCheckHook,
|
||||
writableTmpDirAsHomeHook,
|
||||
}:
|
||||
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
pname = "kilo";
|
||||
version = "7.3.40";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Kilo-Org";
|
||||
repo = "kilocode";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-Jw2C8C7dFPwOGp8tg6ewcRXdVsJEDDFSe+xuF86Xwfc=";
|
||||
};
|
||||
|
||||
node_modules = stdenvNoCC.mkDerivation {
|
||||
pname = "${finalAttrs.pname}-node_modules";
|
||||
inherit (finalAttrs) version src;
|
||||
|
||||
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
|
||||
"GIT_PROXY_COMMAND"
|
||||
"SOCKS_SERVER"
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
bun
|
||||
writableTmpDirAsHomeHook
|
||||
];
|
||||
|
||||
dontConfigure = true;
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
export BUN_INSTALL_CACHE_DIR=$(mktemp -d)
|
||||
bun install \
|
||||
--cpu="*" \
|
||||
--frozen-lockfile \
|
||||
--ignore-scripts \
|
||||
--no-progress \
|
||||
--os="*"
|
||||
|
||||
bun --bun ./nix/scripts/canonicalize-node-modules.ts
|
||||
bun --bun ./nix/scripts/normalize-bun-binaries.ts
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out
|
||||
find . -type d -name node_modules -exec cp -R --parents {} $out \;
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
dontFixup = true;
|
||||
|
||||
outputHash = "sha256-Defmk7fN49UQtBpmWIFGnUiPlBpJtLp+8QaFFQCAY8k=";
|
||||
outputHashAlgo = "sha256";
|
||||
outputHashMode = "recursive";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
bun
|
||||
installShellFiles
|
||||
makeBinaryWrapper
|
||||
models-dev
|
||||
writableTmpDirAsHomeHook
|
||||
];
|
||||
|
||||
strictDeps = true;
|
||||
__structuredAttrs = true;
|
||||
|
||||
postPatch = ''
|
||||
# NOTE: Relax Bun version check to be a warning instead of an error.
|
||||
substituteInPlace packages/script/src/index.ts \
|
||||
--replace-fail 'throw new Error(`This script requires bun@''${expectedBunVersionRange}' \
|
||||
'console.warn(`Warning: This script requires bun@''${expectedBunVersionRange}'
|
||||
substituteInPlace packages/opencode/script/build.ts \
|
||||
--replace-fail 'await $`patchelf --set-interpreter ''${interpreter} dist/''${name}/bin/kilo`' \
|
||||
'await $`true`'
|
||||
'';
|
||||
|
||||
configurePhase = ''
|
||||
runHook preConfigure
|
||||
|
||||
cp -R ${finalAttrs.node_modules}/. .
|
||||
patchShebangs node_modules
|
||||
patchShebangs packages/*/node_modules
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
env.KILO_CHANNEL = "latest";
|
||||
env.KILO_VERSION = finalAttrs.version;
|
||||
env.MODELS_DEV_API_JSON = "${models-dev}/dist/_api.json";
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
cd ./packages/opencode
|
||||
bun --bun ./script/build.ts --single --skip-install --skip-embed-web-ui
|
||||
bun --bun ./script/schema.ts config.json tui.json
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
install -Dm755 dist/@kilocode/cli-*/bin/kilo $out/bin/kilo
|
||||
ln -s kilo $out/bin/kilocode
|
||||
|
||||
wrapProgram $out/bin/kilo \
|
||||
--prefix PATH : ${
|
||||
lib.makeBinPath (
|
||||
[
|
||||
ripgrep
|
||||
]
|
||||
++ lib.optionals stdenvNoCC.hostPlatform.isDarwin [
|
||||
sysctl
|
||||
]
|
||||
)
|
||||
}
|
||||
|
||||
install -Dm644 config.json $out/share/kilocode/config.json
|
||||
install -Dm644 tui.json $out/share/kilocode/tui.json
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
postInstall = lib.optionalString (stdenvNoCC.buildPlatform.canExecute stdenvNoCC.hostPlatform) ''
|
||||
installShellCompletion --cmd kilo \
|
||||
--bash <($out/bin/kilo completion) \
|
||||
--zsh <(SHELL=/bin/zsh $out/bin/kilo completion)
|
||||
'';
|
||||
|
||||
nativeInstallCheckInputs = [
|
||||
versionCheckHook
|
||||
writableTmpDirAsHomeHook
|
||||
];
|
||||
doInstallCheck = true;
|
||||
versionCheckKeepEnvironment = [
|
||||
"HOME"
|
||||
"KILO_CHANNEL"
|
||||
"KILO_VERSION"
|
||||
"MODELS_DEV_API_JSON"
|
||||
];
|
||||
versionCheckProgram = "${placeholder "out"}/bin/kilo";
|
||||
versionCheckProgramArg = "--version";
|
||||
|
||||
passthru = {
|
||||
jsonschema = {
|
||||
config = "${placeholder "out"}/share/kilocode/config.json";
|
||||
tui = "${placeholder "out"}/share/kilocode/tui.json";
|
||||
};
|
||||
updateScript = nix-update-script {
|
||||
extraArgs = [
|
||||
"--subpackage"
|
||||
"node_modules"
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Terminal User Interface for Kilo Code";
|
||||
homepage = "https://github.com/Kilo-Org/kilocode";
|
||||
changelog = "https://github.com/Kilo-Org/kilocode/releases/tag/v${finalAttrs.version}";
|
||||
downloadPage = "https://www.npmjs.com/package/@kilocode/cli";
|
||||
license = lib.licenses.mit;
|
||||
maintainers = with lib.maintainers; [
|
||||
xiaoxiangmoe
|
||||
];
|
||||
sourceProvenance = with lib.sourceTypes; [ fromSource ];
|
||||
mainProgram = "kilo";
|
||||
platforms = [
|
||||
"aarch64-linux"
|
||||
"x86_64-linux"
|
||||
"aarch64-darwin"
|
||||
"x86_64-darwin"
|
||||
];
|
||||
badPlatforms = [
|
||||
# Broken due to Bun requiring AVX when run via Rosetta 2 on Apple Silicon.
|
||||
"x86_64-darwin"
|
||||
];
|
||||
};
|
||||
})
|
||||
@@ -1,136 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
stdenvNoCC,
|
||||
fetchFromGitHub,
|
||||
fetchPnpmDeps,
|
||||
fetchNpmDeps,
|
||||
nodejs,
|
||||
writableTmpDirAsHomeHook,
|
||||
pnpmConfigHook,
|
||||
pnpm_10,
|
||||
unzip,
|
||||
patchelf,
|
||||
autoPatchelfHook,
|
||||
ripgrep,
|
||||
versionCheckHook,
|
||||
nix-update-script,
|
||||
}:
|
||||
let
|
||||
pnpm = pnpm_10;
|
||||
in
|
||||
stdenvNoCC.mkDerivation (finalAttrs: {
|
||||
pname = "kilocode-cli";
|
||||
version = "0.25.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "Kilo-Org";
|
||||
repo = "kilocode-legacy";
|
||||
tag = "cli-v${finalAttrs.version}";
|
||||
hash = "sha256-XlJ9/9FABLpKVJXdIRzbzOpJVXdIzgFvPPeER1LRsuk=";
|
||||
};
|
||||
|
||||
pnpmDeps = fetchPnpmDeps {
|
||||
inherit (finalAttrs) pname version src;
|
||||
inherit pnpm;
|
||||
fetcherVersion = 3;
|
||||
hash = "sha256-Q/LamZwVaIQVILtXRi1RQrYtpxYJWEKPAt3knwm47S0=";
|
||||
};
|
||||
|
||||
npmDeps = fetchNpmDeps {
|
||||
name = "${finalAttrs.pname}-npm-deps";
|
||||
inherit (finalAttrs) src;
|
||||
sourceRoot = "${finalAttrs.src.name}/cli";
|
||||
postPatch = ''
|
||||
cp ./npm-shrinkwrap.dist.json ./npm-shrinkwrap.json
|
||||
'';
|
||||
hash = "sha256-wH4Gyd5nv8sCSQStFqIidoICvlXXEs2xNNX+DH133wA=";
|
||||
};
|
||||
|
||||
buildInputs = [
|
||||
nodejs
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
writableTmpDirAsHomeHook
|
||||
pnpmConfigHook
|
||||
pnpm
|
||||
nodejs
|
||||
unzip
|
||||
patchelf
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isElf [ autoPatchelfHook ];
|
||||
|
||||
strictDeps = true;
|
||||
|
||||
env.npm_config_manage_package_manager_versions = "false";
|
||||
|
||||
buildPhase = ''
|
||||
runHook preBuild
|
||||
|
||||
mkdir -p ./cli/.dist/
|
||||
find ./cli -maxdepth 1 -type f -name "*.dist.*" -print0 | while IFS= read -r -d "" file; do
|
||||
cp "$file" "./cli/.dist/$(basename "$file" | sed 's/\.dist\././')"
|
||||
done
|
||||
|
||||
if ! diff "$PWD/cli/npm-shrinkwrap.dist.json" "$npmDeps/package-lock.json"; then
|
||||
echo "npm-shrinkwrap.json is out of date"
|
||||
echo "The npm-shrinkwrap.json in src is not the same as the in $npmDeps."
|
||||
echo "To fix the issue:"
|
||||
echo '1. Use `lib.fakeHash` as the npmDepsHash value'
|
||||
echo "2. Build the derivation and wait for it to fail with a hash mismatch"
|
||||
echo "3. Copy the 'got: sha256-' value back into the npmDepsHash field"
|
||||
exit 1
|
||||
fi
|
||||
export npm_config_cache="$npmDeps"
|
||||
export npm_config_offline="true"
|
||||
export npm_config_progress="false"
|
||||
(
|
||||
cd ./cli/.dist
|
||||
npm ci --omit=dev --ignore-scripts
|
||||
patchShebangs node_modules
|
||||
if [ -d node_modules/@vscode/ripgrep ]; then
|
||||
mkdir -p node_modules/@vscode/ripgrep/bin
|
||||
ln -s ${lib.getExe ripgrep} node_modules/@vscode/ripgrep/bin/rg
|
||||
fi
|
||||
npm rebuild
|
||||
)
|
||||
substituteInPlace cli/package.json \
|
||||
--replace-fail 'npm install --omit=dev --prefix ./dist' 'mv ./.dist/node_modules ./dist/node_modules'
|
||||
|
||||
node --run cli:bundle
|
||||
touch ./cli/dist/.env
|
||||
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
mkdir -p $out/bin/ $out/lib/node_modules/@kilocode/
|
||||
mv ./cli/dist $out/lib/node_modules/@kilocode/cli
|
||||
ln -s $out/lib/node_modules/@kilocode/cli/index.js $out/bin/kilocode
|
||||
chmod +x $out/bin/kilocode
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
nativeInstallCheckInputs = [ versionCheckHook ];
|
||||
doInstallCheck = true;
|
||||
versionCheckProgramArg = "--version";
|
||||
|
||||
passthru = {
|
||||
updateScript = nix-update-script { extraArgs = [ "--version-regex=^cli-v(.+)$" ]; };
|
||||
};
|
||||
|
||||
meta = {
|
||||
description = "Terminal User Interface for Kilo Code";
|
||||
homepage = "https://kilocode.ai/cli";
|
||||
downloadPage = "https://www.npmjs.com/package/@kilocode/cli";
|
||||
license = lib.licenses.asl20;
|
||||
maintainers = with lib.maintainers; [
|
||||
xiaoxiangmoe
|
||||
];
|
||||
mainProgram = "kilocode";
|
||||
};
|
||||
})
|
||||
@@ -1071,6 +1071,7 @@ mapAliases {
|
||||
kgx = throw "'kgx' has been renamed to/replaced by 'gnome-console'"; # Converted to throw 2025-10-27
|
||||
khd = throw "'khd' has been removed as it has been pulled upstream"; # Added 2025-12-18
|
||||
khoj = throw "khoj has been removed because it has been marked as broken since at least November 2024."; # Added 2025-10-11
|
||||
kilocode-cli = warnAlias "'kilocode-cli' has been renamed to/replaced by 'kilo'" kilo; # Added 2026-04-30
|
||||
kio-fuse = throw "'kio-fuse' has been removed, as Plasma 5 has reached end of life. Use 'kdePackages.kio-fuse' for Plasma 6."; # Added 2026-05-01
|
||||
kmplayer = throw "'kmplayer' has been removed, as it is unmaintained upstream"; # Added 2025-08-30
|
||||
knot-resolver = warnAlias "'knot-resolver' is currently aliased to 'knot-resolver_5'. This will change with the knot-resolver 6 being declared as stable. Please explicitly use the 'knot-resolver_5' or 'knot-resolver_6' package until then." knot-resolver_5; # Added 2025-11-30
|
||||
|
||||
Reference in New Issue
Block a user