chore: update llama-cpp to b7898 and opencode to v1.1.48

- Update llama-cpp from b7867 to b7898
- Update opencode from v1.1.12 to v1.1.48 with improved build process:
  - Replace custom bundle script with official script/build.ts
  - Add shell completion support
  - Add version check testing
  - Simplify node_modules handling
- Update llama-swap service config with new llama.cpp options
- Clarify opencode agent testing workflow in developer and reviewer configs
This commit is contained in:
2026-02-03 20:33:14 -05:00
parent 15259b5ec3
commit 7080727dce
8 changed files with 174 additions and 163 deletions

View File

@@ -7,12 +7,12 @@
vulkanSupport = true;
}).overrideAttrs
(oldAttrs: rec {
version = "7867";
version = "7898";
src = pkgs.fetchFromGitHub {
owner = "ggml-org";
repo = "llama.cpp";
tag = "b${version}";
hash = "sha256-uAsIObuU6BboNatK58XL/YDVLmJsgU3Z6gI2vvFG+pw=";
hash = "sha256-ST7hhE5lWOm46WS+k9lkHJqVQpz8squwHZWE2/XG6MY=";
leaveDotGit = true;
postFetch = ''
git -C "$out" rev-parse --short HEAD > $out/COMMIT

View File

@@ -1,33 +0,0 @@
#!/usr/bin/env bun
import solidPlugin from "./node_modules/@opentui/solid/scripts/solid-plugin";
import fs from "fs";
const version = process.env.OPENCODE_VERSION!;
const channel = process.env.OPENCODE_CHANNEL!;
const result = await Bun.build({
target: "bun",
outdir: "./dist",
entrypoints: ["./src/index.ts", "./src/cli/cmd/tui/worker.ts"],
plugins: [solidPlugin],
naming: {
entry: "[dir]/[name].js",
},
define: {
OPENCODE_VERSION: JSON.stringify(version),
OPENCODE_CHANNEL: JSON.stringify(channel),
},
external: ["@opentui/core-*"],
});
if (!result.success) {
console.error("Bundle failed:", result.logs);
process.exit(1);
}
// Move worker file to worker.ts at the dist root so the code can find it
if (fs.existsSync("./dist/cli/cmd/tui/worker.js")) {
fs.renameSync("./dist/cli/cmd/tui/worker.js", "./dist/worker.ts");
fs.rmdirSync("./dist/cli/cmd/tui", { recursive: true });
}

View File

@@ -7,23 +7,24 @@
, models-dev
, nix-update-script
, ripgrep
, testers
, installShellFiles
, versionCheckHook
, writableTmpDirAsHomeHook
,
}:
let
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "opencode";
version = "1.1.12";
version = "1.1.48";
src = fetchFromGitHub {
owner = "anomalyco";
repo = "opencode";
tag = "v${version}";
hash = "sha256-k6wRBtWFwyLWJ6R0el3dY/nBlg2t+XkTpsuEseLXp+E=";
tag = "v${finalAttrs.version}";
hash = "sha256-zKkeJSsxEuhucQkWBHxLR7tCTu86q2p6neRST2g/1hA="; # "sha256-RTj64yrVLTFNpVc8MvPAJISOlBo/j2MnuL5jo4VtKWM=";
};
node_modules = stdenvNoCC.mkDerivation {
pname = "${pname}-node_modules";
inherit version src;
pname = "${finalAttrs.pname}-node_modules";
inherit (finalAttrs) version src;
impureEnvVars = lib.fetchers.proxyImpureEnvVars ++ [
"GIT_PROXY_COMMAND"
@@ -40,20 +41,17 @@ let
buildPhase = ''
runHook preBuild
export BUN_INSTALL_CACHE_DIR=$(mktemp -d)
bun install \
--cpu="*" \
--filter=./packages/opencode \
--force \
--frozen-lockfile \
--filter ./packages/opencode \
--filter ./packages/desktop \
--ignore-scripts \
--no-progress \
--os="*" \
--production
--os="*"
bun run ./nix/scripts/canonicalize-node-modules.ts
bun run ./nix/scripts/normalize-bun-binaries.ts
bun --bun ./nix/scripts/canonicalize-node-modules.ts
bun --bun ./nix/scripts/normalize-bun-binaries.ts
runHook postBuild
'';
@@ -62,12 +60,7 @@ let
runHook preInstall
mkdir -p $out
while IFS= read -r dir; do
rel="''${dir#./}"
dest="$out/$rel"
mkdir -p "$(dirname "$dest")"
cp -R "$dir" "$dest"
done < <(find . -type d -name node_modules -prune | sort)
find . -type d -name node_modules -exec cp -R --parents {} $out \;
runHook postInstall
'';
@@ -75,34 +68,35 @@ let
# NOTE: Required else we get errors that our fixed-output derivation references store paths
dontFixup = true;
outputHash = "sha256-vRIWQt02VljcoYG3mwJy8uCihSTB/OLypyw+vt8LuL8=";
outputHash = "sha256-aQScGeakRanvH1LxizXrWA17YOmJJfRuypX4Jau4zQw="; # "sha256-37pmIiJzPEWeA7+5u5lz39vlFPI+N13Qw9weHrAaGW4=";
outputHashAlgo = "sha256";
outputHashMode = "recursive";
};
in
stdenvNoCC.mkDerivation (finalAttrs: {
inherit
pname
version
src
node_modules
;
nativeBuildInputs = [
bun
installShellFiles
makeBinaryWrapper
models-dev
writableTmpDirAsHomeHook
];
patches = [
./relax-bun-version-check.patch # NOTE: Relax Bun version check to be a warning instead of an error
./remove-special-and-windows-build-targets.patch # NOTE: Remove special and windows build targes
./root_fix.patch # https://github.com/anomalyco/opencode/pull/7691
];
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}'
'';
configurePhase = ''
runHook preConfigure
cp -R ${node_modules}/. .
cp -R ${finalAttrs.node_modules}/. .
runHook postConfigure
'';
@@ -113,13 +107,6 @@ stdenvNoCC.mkDerivation (finalAttrs: {
preBuild = ''
chmod -R u+w ./packages/opencode/node_modules
pushd ./packages/opencode/node_modules/@parcel/
for pkg in ../../../../node_modules/.bun/@parcel+watcher-*; do
linkName=$(basename "$pkg" | sed 's/@.*+\(.*\)@.*/\1/')
ln -sf "$pkg/node_modules/@parcel/$linkName" "$linkName"
done
popd
pushd ./packages/opencode/node_modules/@opentui/
for pkg in ../../../../node_modules/.bun/@opentui+core-*; do
linkName=$(basename "$pkg" | sed 's/@.*+\(.*\)@.*/\1/')
@@ -131,74 +118,47 @@ stdenvNoCC.mkDerivation (finalAttrs: {
buildPhase = ''
runHook preBuild
cd ./packages/opencode
cp ${./bundle.ts} ./bundle.ts
bun run ./bundle.ts
bun --bun ./script/build.ts --single --skip-install
bun --bun ./script/schema.ts schema.json
runHook postBuild
'';
dontStrip = true;
installPhase = ''
runHook preInstall
mkdir -p $out/lib/opencode
# Copy the bundled dist directory
cp -r dist $out/lib/opencode/
# Fix WASM paths in worker.ts - use absolute paths to the installed location
# Main wasm is tree-sitter-<hash>.wasm, language wasms are tree-sitter-<lang>-<hash>.wasm
main_wasm=$(find "$out/lib/opencode/dist" -maxdepth 1 -name 'tree-sitter-[a-z0-9]*.wasm' -print -quit)
substituteInPlace $out/lib/opencode/dist/worker.ts \
--replace-fail 'module2.exports = "../../../tree-sitter-' 'module2.exports = "'"$out"'/lib/opencode/dist/tree-sitter-' \
--replace-fail 'new URL("tree-sitter.wasm", import.meta.url).href' "\"$main_wasm\""
# Copy only the native modules we need (marked as external in bundle.ts)
mkdir -p $out/lib/opencode/node_modules/.bun
mkdir -p $out/lib/opencode/node_modules/@opentui
# Copy @opentui/core platform-specific packages
for pkg in ../../node_modules/.bun/@opentui+core-*; do
if [ -d "$pkg" ]; then
cp -r "$pkg" $out/lib/opencode/node_modules/.bun/$(basename "$pkg")
fi
done
mkdir -p $out/bin
makeWrapper ${lib.getExe bun} $out/bin/opencode \
--add-flags "run" \
--add-flags "$out/lib/opencode/dist/index.js" \
--prefix PATH : ${
lib.makeBinPath [
fzf
ripgrep
]
} \
--argv0 opencode
install -Dm755 dist/opencode-*/bin/opencode $out/bin/opencode
install -Dm644 schema.json $out/share/opencode/schema.json
runHook postInstall
'';
postInstall = ''
# Add symlinks for platform-specific native modules
for pkg in $out/lib/opencode/node_modules/.bun/@opentui+core-*; do
if [ -d "$pkg" ]; then
pkgName=$(basename "$pkg" | sed 's/@opentui+\(core-[^@]*\)@.*/\1/')
ln -sf ../.bun/$(basename "$pkg")/node_modules/@opentui/$pkgName \
$out/lib/opencode/node_modules/@opentui/$pkgName
fi
done
postInstall = lib.optionalString (stdenvNoCC.buildPlatform.canExecute stdenvNoCC.hostPlatform) ''
installShellCompletion --cmd opencode \
--bash <($out/bin/opencode completion)
'';
postFixup = ''
wrapProgram $out/bin/opencode \
--prefix PATH : ${
lib.makeBinPath [
fzf
ripgrep
]
}
'';
nativeInstallCheckInputs = [
versionCheckHook
writableTmpDirAsHomeHook
];
doInstallCheck = true;
versionCheckKeepEnvironment = [ "HOME" ];
versionCheckProgramArg = "--version";
passthru = {
tests.version = testers.testVersion {
package = finalAttrs.finalPackage;
command = "HOME=$(mktemp -d) opencode --version";
inherit (finalAttrs) version;
};
jsonschema = "${placeholder "out"}/share/opencode/schema.json";
updateScript = nix-update-script {
extraArgs = [
"--subpackage"
@@ -209,13 +169,13 @@ stdenvNoCC.mkDerivation (finalAttrs: {
meta = {
description = "AI coding agent built for the terminal";
longDescription = ''
OpenCode is a terminal-based agent that can build anything.
It combines a TypeScript/JavaScript core with a Go-based TUI
to provide an interactive AI coding experience.
'';
homepage = "https://github.com/sst/opencode";
homepage = "https://github.com/anomalyco/opencode";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
delafthi
graham33
];
sourceProvenance = with lib.sourceTypes; [ fromSource ];
platforms = [
"aarch64-linux"
"x86_64-linux"

View File

@@ -1,28 +0,0 @@
From 0e07ea8225f5667e39c6aa59eea726266f0afab0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Thu, 13 Nov 2025 10:16:31 +0100
Subject: [PATCH] Change Bun version check from error to warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
---
packages/script/src/index.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/packages/script/src/index.ts b/packages/script/src/index.ts
index 141d2b75..de06d0dc 100644
--- a/packages/script/src/index.ts
+++ b/packages/script/src/index.ts
@@ -10,7 +10,7 @@ if (!expectedBunVersion) {
}
if (process.versions.bun !== expectedBunVersion) {
- throw new Error(`This script requires bun@${expectedBunVersion}, but you are using bun@${process.versions.bun}`)
+ console.warn(`Warning: This script expects bun@${expectedBunVersion}, but you are using bun@${process.versions.bun}`)
}
const CHANNEL = process.env["OPENCODE_CHANNEL"] ?? (await $`git branch --show-current`.text().then((x) => x.trim()))
--
2.51.0

View File

@@ -0,0 +1,99 @@
From 4d0a82e8f3cf8bf011e2592677db4aa31b6b290b Mon Sep 17 00:00:00 2001
From: Thierry Delafontaine <delafthi@pm.me>
Date: Sun, 4 Jan 2026 20:55:49 +0100
Subject: [PATCH] Remove special and windows build targets
---
packages/opencode/script/build.ts | 70 +++++++++++++++----------------
1 file changed, 35 insertions(+), 35 deletions(-)
diff --git a/packages/opencode/script/build.ts b/packages/opencode/script/build.ts
index f51cb2924..ee3c0e863 100755
--- a/packages/opencode/script/build.ts
+++ b/packages/opencode/script/build.ts
@@ -33,27 +33,27 @@ const allTargets: {
os: "linux",
arch: "x64",
},
- {
- os: "linux",
- arch: "x64",
- avx2: false,
- },
- {
- os: "linux",
- arch: "arm64",
- abi: "musl",
- },
- {
- os: "linux",
- arch: "x64",
- abi: "musl",
- },
- {
- os: "linux",
- arch: "x64",
- abi: "musl",
- avx2: false,
- },
+ // {
+ // os: "linux",
+ // arch: "x64",
+ // avx2: false,
+ // },
+ // {
+ // os: "linux",
+ // arch: "arm64",
+ // abi: "musl",
+ // },
+ // {
+ // os: "linux",
+ // arch: "x64",
+ // abi: "musl",
+ // },
+ // {
+ // os: "linux",
+ // arch: "x64",
+ // abi: "musl",
+ // avx2: false,
+ // },
{
os: "darwin",
arch: "arm64",
@@ -62,20 +62,20 @@ const allTargets: {
os: "darwin",
arch: "x64",
},
- {
- os: "darwin",
- arch: "x64",
- avx2: false,
- },
- {
- os: "win32",
- arch: "x64",
- },
- {
- os: "win32",
- arch: "x64",
- avx2: false,
- },
+ // {
+ // os: "darwin",
+ // arch: "x64",
+ // avx2: false,
+ // },
+ // {
+ // os: "win32",
+ // arch: "x64",
+ // },
+ // {
+ // os: "win32",
+ // arch: "x64",
+ // avx2: false,
+ // },
]
const targets = singleFlag
--
2.52.0