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:
27
AGENTS.md
27
AGENTS.md
@@ -251,6 +251,33 @@ When modifying overlay behavior:
|
||||
- [Nix Flake Patterns](https://github.com/NixOS/flake-patterns)
|
||||
- [Rust in Nixpkgs](https://nixos.org/manual/nixpkgs/stable/#rust)
|
||||
|
||||
## Updating Packages
|
||||
|
||||
Use [nix-update](https://github.com/Mic92/nix-update) to bump versions and update hashes:
|
||||
|
||||
```bash
|
||||
# Update a package to the latest version
|
||||
nix-update <package-name>
|
||||
|
||||
# Update to a specific version
|
||||
nix-update <package-name> --version <version>
|
||||
|
||||
# Update a package pinned to a commit hash (e.g. skillsmcp)
|
||||
nix-update <package-name> --version=branch=main
|
||||
```
|
||||
|
||||
After updating, always test the build:
|
||||
|
||||
```bash
|
||||
nix build .#<package-name>
|
||||
```
|
||||
|
||||
### Package-Specific Notes
|
||||
|
||||
- **goose-cli**: Also updates `librusty_v8` hashes automatically via the custom fetcher
|
||||
- **mcp-gateway**: Standard Rust package, `nix-update` handles version + cargoHash
|
||||
- **skillsmcp**: Pinned to a commit hash; use `--version=branch=main` or specify the target commit with `--commit`
|
||||
|
||||
## Git Workflow
|
||||
|
||||
### Committing Completed Work
|
||||
|
||||
@@ -95,13 +95,16 @@ nix develop
|
||||
```
|
||||
nix-overlay/
|
||||
├── flake.nix # Flake definition
|
||||
├── treefmt.toml # Code formatting configuration (nixfmt)
|
||||
├── overlays/ # Overlay implementations
|
||||
│ ├── default.nix # Binary-cache-friendly overlay
|
||||
│ └── shared-nixpkgs.nix # Dependency-sharing overlay
|
||||
├── packages/ # Package definitions
|
||||
│ ├── default/ # Meta-package listing all packages
|
||||
│ ├── goose-cli/ # Goose CLI package
|
||||
│ └── flake-inputs/ # Utility for caching flake inputs
|
||||
│ ├── flake-inputs/ # Utility for caching flake inputs
|
||||
│ ├── goose-cli/ # Goose AI agent CLI
|
||||
│ ├── mcp-gateway/ # MCP protocol gateway
|
||||
│ └── skillsmcp/ # MCP server for Agent Skills
|
||||
└── README.md
|
||||
```
|
||||
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
{
|
||||
description = "Various packages for Nix";
|
||||
|
||||
nixConfig = {
|
||||
extra-substituters = [ "https://cache.nixos.org" ];
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
systems.url = "github:nix-systems/default";
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
@@ -27,12 +27,15 @@ rustPlatform.buildRustPackage rec {
|
||||
|
||||
doCheck = false;
|
||||
|
||||
passthru.category = "MCP Servers";
|
||||
|
||||
meta = with lib; {
|
||||
description = "Universal Model Context Protocol gateway that sits between AI client and MCP tools/servers";
|
||||
homepage = "https://github.com/MikkoParkkola/mcp-gateway";
|
||||
changelog = "https://github.com/MikkoParkkola/mcp-gateway/releases/tag/v${version}";
|
||||
license = lib.licenses.mit;
|
||||
sourceProvenance = with lib.sourceTypes; [ fromSource ];
|
||||
license = licenses.mit;
|
||||
sourceProvenance = with sourceTypes; [ fromSource ];
|
||||
mainProgram = "mcp-gateway";
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ python3Packages.buildPythonApplication rec {
|
||||
|
||||
# Disable all checks to avoid version issues
|
||||
doCheck = false;
|
||||
pythonImportsCheck = [ ];
|
||||
pythonImportsCheck = [ "skillsmcp" ];
|
||||
|
||||
# Patch to accept fastmcp 2.x from nixpkgs
|
||||
postPatch = ''
|
||||
@@ -43,6 +43,6 @@ python3Packages.buildPythonApplication rec {
|
||||
homepage = "https://github.com/aviddiviner/skillsmcp";
|
||||
license = licenses.mit;
|
||||
mainProgram = "skillsmcp";
|
||||
maintainers = with maintainers; [ ];
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
||||
|
||||
6
treefmt.toml
Normal file
6
treefmt.toml
Normal file
@@ -0,0 +1,6 @@
|
||||
[global]
|
||||
excluded = ["flake.lock"]
|
||||
|
||||
[formatter.nix]
|
||||
command = "nixfmt"
|
||||
includes = ["*.nix"]
|
||||
Reference in New Issue
Block a user