refactor: rewrote ai-tools-nix to llm-agent.nix by numtide

This commit is contained in:
Rasyidan Akbar F. 2025-12-18 16:11:45 +07:00
commit 11b4bb2e97
7 changed files with 111 additions and 299 deletions

View file

@ -1,8 +1,11 @@
{ pkgs, lib, beads }:
{ pkgs, lib, llm-agents }:
{
let
system = pkgs.stdenv.hostPlatform.system;
llmPkgs = llm-agents.packages.${system};
in {
osgrep = pkgs.callPackage ./osgrep.nix { };
opencode = pkgs.callPackage ./opencode.nix { };
# Re-export beads from flake input for consistent access
beads = beads.packages.${pkgs.stdenv.hostPlatform.system}.default;
opencode = llmPkgs.opencode;
# Source beads from llm-agents.nix
beads = llmPkgs.beads;
}

View file

@ -1,59 +0,0 @@
{ lib, stdenv, fetchzip, autoPatchelfHook }:
let
version = "1.0.137";
platformInfo = {
x86_64-darwin = {
name = "darwin-x64";
ext = "zip";
hash = "sha256-ZgzvpW8SAN0HP3Qh+aT1S+WrEoXkTZiL8/8z1w9p9Y0=";
};
aarch64-darwin = {
name = "darwin-arm64";
ext = "zip";
hash = "sha256-w5hs5arVroLtjr9pRAHYXQL+4L5gw1bJVL4DhgvrpLs=";
};
x86_64-linux = {
name = "linux-x64";
ext = "tar.gz";
hash = "sha256-N8IR3xq/dGF5jPq9/UW8Mu/PnAUb7r+Ox6nge6wKw1M=";
};
aarch64-linux = {
name = "linux-arm64";
ext = "tar.gz";
hash = "sha256-LwWbTAVnfEmCjUBNf58bgFFVVvDIQVJkLsGtYX+/EfU=";
};
};
platform = platformInfo.${stdenv.hostPlatform.system} or (throw
"Unsupported system: ${stdenv.hostPlatform.system}");
in stdenv.mkDerivation {
pname = "opencode";
inherit version;
src = fetchzip {
url =
"https://github.com/sst/opencode/releases/download/v${version}/opencode-${platform.name}.${platform.ext}";
hash = platform.hash;
stripRoot = false;
};
nativeBuildInputs = lib.optionals stdenv.isLinux [ autoPatchelfHook ];
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp opencode $out/bin/opencode
chmod +x $out/bin/opencode
runHook postInstall
'';
meta = {
description = "AI coding assistant CLI from SST";
homepage = "https://opencode.ai";
license = lib.licenses.mit;
mainProgram = "opencode";
platforms =
[ "x86_64-darwin" "aarch64-darwin" "x86_64-linux" "aarch64-linux" ];
};
}