fix: improve package quality and fix goose-cli build

- Add meta.platforms to all packages for proper platform detection
- Add passthru.category to mcp-gateway for consistency
- Fix meta style inconsistency in mcp-gateway (lib.licenses → licenses)
- Fix pythonImportsCheck in skillsmcp to actually validate the import
- Remove empty maintainers list from skillsmcp
- Add libclang to goose-cli nativeBuildInputs (fixes bindgen/llama-cpp-sys-2 build)
- Add treefmt.toml with nixfmt formatter configuration
- Add nixConfig.extra-substituters for binary cache support
- Delete broken goose-cli/update.py (referenced missing scripts/updater.py)
- Document nix-update usage in AGENTS.md for package updates
- Fix stale project structure diagram in README
This commit is contained in:
2026-05-06 12:54:26 +03:00
parent 83ab7d0a19
commit c68a821a00
8 changed files with 58 additions and 114 deletions

View File

@@ -8,6 +8,7 @@
dbus,
versionCheckHook,
librusty_v8,
llvmPackages,
}:
rustPlatform.buildRustPackage rec {
@@ -23,7 +24,10 @@ rustPlatform.buildRustPackage rec {
cargoHash = "sha256-fN0FKDYFkZrQQPWdUlemOaGzIAZhqFyskz9TEmG+X4o=";
nativeBuildInputs = [ pkg-config ];
nativeBuildInputs = [
pkg-config
llvmPackages.libclang
];
buildInputs = [
openssl
@@ -35,6 +39,9 @@ rustPlatform.buildRustPackage rec {
# To avoid this we pre-download the file and export it via RUSTY_V8_ARCHIVE
env.RUSTY_V8_ARCHIVE = librusty_v8;
# bindgen (used by llama-cpp-sys-2) needs libclang
env.LIBCLANG_PATH = llvmPackages.libclang.lib;
# Build only the CLI package
cargoBuildFlags = [
"--package"
@@ -67,5 +74,6 @@ rustPlatform.buildRustPackage rec {
license = licenses.asl20;
sourceProvenance = with sourceTypes; [ fromSource ];
mainProgram = "goose";
platforms = platforms.all;
};
}

View File

@@ -1,107 +0,0 @@
#!/usr/bin/env nix
#! nix shell --inputs-from .# nixpkgs#python3 --command python3
"""Update script for goose-cli package.
This script updates both the goose-cli version and the librusty_v8 hashes.
The v8 version is extracted from the Cargo.lock file of the goose repository.
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).parent.parent.parent / "scripts"))
from updater import (
calculate_platform_hashes,
fetch_text,
load_hashes,
save_hashes,
)
HASHES_FILE = Path(__file__).parent / "librusty_v8_hashes.json"
PLATFORMS = {
"x86_64-linux": "x86_64-unknown-linux-gnu",
"aarch64-linux": "aarch64-unknown-linux-gnu",
"x86_64-darwin": "x86_64-apple-darwin",
"aarch64-darwin": "aarch64-apple-darwin",
}
def fetch_v8_version_from_cargo_lock(goose_version: str) -> str:
"""Extract the v8 version from goose's Cargo.lock file."""
url = f"https://raw.githubusercontent.com/block/goose/v{goose_version}/Cargo.lock"
cargo_lock = fetch_text(url)
# Parse the Cargo.lock to find v8 version
lines = cargo_lock.split("\n")
for i, line in enumerate(lines):
if line.strip() == 'name = "v8"':
# Look for version in the next few lines
for j in range(i + 1, min(i + 10, len(lines))):
if "version = " in lines[j]:
return lines[j].split('"')[1]
msg = "Could not find v8 version in Cargo.lock"
raise ValueError(msg)
def main() -> None:
"""Update the librusty_v8 hashes for goose-cli."""
# Read the current goose-cli version from package.nix
package_nix = (Path(__file__).parent / "package.nix").read_text()
for line in package_nix.split("\n"):
if "version = " in line and '"' in line:
goose_version = line.split('"')[1]
break
else:
msg = "Could not find version in package.nix"
raise ValueError(msg)
print(f"Goose version: {goose_version}")
# Get the v8 version from Cargo.lock
v8_version = fetch_v8_version_from_cargo_lock(goose_version)
print(f"V8 version: {v8_version}")
# Check if we need to update
try:
data = load_hashes(HASHES_FILE)
current_v8 = data.get("version", "")
if current_v8 == v8_version:
print(f"V8 hashes already up to date ({v8_version})")
return
except FileNotFoundError:
print("No existing hashes file, creating new one")
# Calculate hashes for all platforms
url_template = f"https://github.com/denoland/rusty_v8/releases/download/v{v8_version}/librusty_v8_release_{{platform}}.a.gz"
hashes = calculate_platform_hashes(url_template, PLATFORMS)
# Save the hashes
save_hashes(HASHES_FILE, {"version": v8_version, "hashes": hashes})
# Update librusty_v8.nix
librusty_v8_nix = Path(__file__).parent / "librusty_v8.nix"
content = f"""# Pre-built librusty_v8 library for goose-cli
# This file specifies the rusty_v8 version and hashes for all supported platforms
{{ fetchLibrustyV8 }}:
fetchLibrustyV8 {{
version = "{v8_version}";
shas = {{
x86_64-linux = "{hashes["x86_64-linux"]}";
aarch64-linux = "{hashes["aarch64-linux"]}";
x86_64-darwin = "{hashes["x86_64-darwin"]}";
aarch64-darwin = "{hashes["aarch64-darwin"]}";
}};
}}
"""
librusty_v8_nix.write_text(content)
print(f"Updated librusty_v8 to {v8_version}")
if __name__ == "__main__":
main()