Some checks failed
CI / check (push) Has been cancelled
- aionui 2.1.4 -> 2.1.50 - desloppify 0.9.15 -> 1.0 - ds4 -> 2026-08-05 (b030961) - freebuff 0.0.85 -> 0.0.142 (binary moved to GitHub releases) - graphify 0.7.10 -> 0.9.35 (license Apache-2.0, fix sed patterns for versioned deps) - hipengine 0.2.2 -> 0.3.0 (console script renamed to hipengine) - kubernetes-mcp-server 0.0.62 -> 0.0.66 (requires go >= 1.26.3) - mcp-gateway 2.11.0 -> 3.4.0 (requires rustc >= 1.95) - omniroute 3.8.28 -> 3.8.49 - radar 1.6.1 -> 1.9.1 (drop obsolete lockfile sed patch) - relay-free-llm -> 96e6c48, cerebras-cloud-sdk 1.67.0 -> 1.91.0 - stakpak 0.3.86 -> 0.3.88 Add nixpkgs-latest input for toolchains newer than the pinned nixpkgs.
154 lines
4.7 KiB
Nix
154 lines
4.7 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchurl,
|
|
nodejs,
|
|
makeWrapper,
|
|
patchelf,
|
|
glibc,
|
|
}:
|
|
|
|
let
|
|
version = "0.0.142";
|
|
|
|
freebuffSrc = fetchurl {
|
|
url = "https://registry.npmjs.org/freebuff/-/freebuff-${version}.tgz";
|
|
hash = "sha256-8DSNy/wJqLzp7mu2xsPBlMv69aBMIBNVva3SAaV13Tw=";
|
|
};
|
|
|
|
pkgTar = fetchurl {
|
|
url = "https://registry.npmjs.org/tar/-/tar-7.5.15.tgz";
|
|
hash = "sha256-hl60jJtM1W2THQyGZj8G72GEG8QvVrHvNnr7EU1liBw=";
|
|
};
|
|
|
|
pkgFsMinipass = fetchurl {
|
|
url = "https://registry.npmjs.org/@isaacs/fs-minipass/-/fs-minipass-4.0.1.tgz";
|
|
hash = "sha256-esKG48zMHqiYDnniA53va7l9MYLheVHNkJTwQA7ZgjY=";
|
|
};
|
|
|
|
pkgChownr = fetchurl {
|
|
url = "https://registry.npmjs.org/chownr/-/chownr-3.0.0.tgz";
|
|
hash = "sha256-TCT12qYwFCJS2oneZV998JDqR5RQqIJYl3UdeDIbE2A=";
|
|
};
|
|
|
|
pkgMinipass = fetchurl {
|
|
url = "https://registry.npmjs.org/minipass/-/minipass-7.1.3.tgz";
|
|
hash = "sha256-UqxhvnQ3VeP9yY5WAIbQ1KHix/02Qzh3kts44yLSfRI=";
|
|
};
|
|
|
|
pkgMinizlib = fetchurl {
|
|
url = "https://registry.npmjs.org/minizlib/-/minizlib-3.1.0.tgz";
|
|
hash = "sha256-mb8uKWGBct1x8GVHN0kMaPcbx+I3nUc+OPn+8tvs4uM=";
|
|
};
|
|
|
|
pkgYallist = fetchurl {
|
|
url = "https://registry.npmjs.org/yallist/-/yallist-5.0.0.tgz";
|
|
hash = "sha256-fJ1D26t8qzsxM7Dmpa8UAUSCKFMWs57J9QjvrdnrzpU=";
|
|
};
|
|
|
|
binarySrc = fetchurl {
|
|
url = "https://github.com/CodebuffAI/codebuff-community/releases/download/freebuff-v${version}/freebuff-linux-x64.tar.gz";
|
|
hash = "sha256-SuV5djfrvRZZ59p+dUyiux+OmEMOxscuIU5/YDGWHYI=";
|
|
};
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
pname = "freebuff";
|
|
version = "0.0.142";
|
|
|
|
src = freebuffSrc;
|
|
|
|
nativeBuildInputs = [
|
|
makeWrapper
|
|
patchelf
|
|
];
|
|
|
|
dontStrip = true;
|
|
dontPatchelf = true;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
# Extract and patch the pre-built binary for NixOS compatibility
|
|
mkdir -p "$out/bin" /tmp/fb-engine
|
|
tar xzf "${binarySrc}" -C /tmp/fb-engine --strip-components=0
|
|
cp /tmp/fb-engine/freebuff "$out/bin/freebuff-engine"
|
|
chmod 755 "$out/bin/freebuff-engine"
|
|
|
|
patchelf \
|
|
--set-interpreter "${glibc}/lib/ld-linux-x86-64.so.2" \
|
|
--set-rpath "${glibc}/lib:" \
|
|
"$out/bin/freebuff-engine"
|
|
|
|
if [ -f /tmp/fb-engine/tree-sitter.wasm ]; then
|
|
cp /tmp/fb-engine/tree-sitter.wasm "$out/bin/"
|
|
fi
|
|
|
|
rm -rf /tmp/fb-engine
|
|
|
|
# Extract npm dependencies from pre-fetched tarballs
|
|
extractNpmPkg() {
|
|
local src="$1" target="$2"
|
|
mkdir -p "$target"
|
|
tar xzf "$src" -C "$target" --strip-components=1
|
|
}
|
|
|
|
mkdir -p "$out/lib/node_modules/tar"
|
|
mkdir -p "$out/lib/node_modules/chownr"
|
|
mkdir -p "$out/lib/node_modules/minipass"
|
|
mkdir -p "$out/lib/node_modules/minizlib"
|
|
mkdir -p "$out/lib/node_modules/yallist"
|
|
mkdir -p "$out/lib/node_modules/@isaacs/fs-minipass"
|
|
|
|
extractNpmPkg "${pkgTar}" "$out/lib/node_modules/tar"
|
|
extractNpmPkg "${pkgChownr}" "$out/lib/node_modules/chownr"
|
|
extractNpmPkg "${pkgMinipass}" "$out/lib/node_modules/minipass"
|
|
extractNpmPkg "${pkgMinizlib}" "$out/lib/node_modules/minizlib"
|
|
extractNpmPkg "${pkgYallist}" "$out/lib/node_modules/yallist"
|
|
extractNpmPkg "${pkgFsMinipass}" "$out/lib/node_modules/@isaacs/fs-minipass"
|
|
|
|
# Launcher: run the patched engine directly from nix-store
|
|
cat > "$out/bin/launcher.js" << LAUNCHER_EOF
|
|
#!/usr/bin/env node
|
|
const { spawn } = require('child_process');
|
|
const TERMINAL_RESET = '\x1b[?1049l\x1b[?1000l\x1b[?1002l\x1b[?1003l\x1b[?1006l\x1b[?2004l\x1b[?25h';
|
|
const engine = '${placeholder "out"}/bin/freebuff-engine';
|
|
|
|
function reset() {
|
|
try { if (process.stdin.isTTY && process.stdin.setRawMode) process.stdin.setRawMode(false); } catch(e){}
|
|
try { if (process.stdout.isTTY) process.stdout.write(TERMINAL_RESET); } catch(e){}
|
|
}
|
|
|
|
const child = spawn(engine, process.argv.slice(2), { stdio: 'inherit' });
|
|
child.on('exit', (code, signal) => { reset(); process.exit(signal ? 1 : code || 0); });
|
|
child.on('error', (e) => { console.error('Failed to start freebuff:', e.message); process.exit(1); });
|
|
LAUNCHER_EOF
|
|
|
|
makeWrapper "${nodejs}/bin/node" "$out/bin/freebuff" \
|
|
--set NODE_PATH "$out/lib/node_modules" \
|
|
--add-flags "$out/bin/launcher.js"
|
|
|
|
runHook postInstall
|
|
'';
|
|
|
|
doCheck = false;
|
|
|
|
passthru = {
|
|
category = "AI Coding Agents";
|
|
updateScript = [
|
|
"nix-update"
|
|
"--flake"
|
|
".#freebuff"
|
|
];
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "The world's strongest free coding agent";
|
|
homepage = "https://codebuff.com";
|
|
license = licenses.mit;
|
|
mainProgram = "freebuff";
|
|
platforms = platforms.linux;
|
|
};
|
|
}
|