diff --git a/AGENTS.md b/AGENTS.md index a16c8e3..e9ddb07 100644 --- a/AGENTS.md +++ b/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 + +# Update to a specific version +nix-update --version + +# Update a package pinned to a commit hash (e.g. skillsmcp) +nix-update --version=branch=main +``` + +After updating, always test the build: + +```bash +nix build .# +``` + +### 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 diff --git a/README.md b/README.md index 447ca4e..70c650b 100644 --- a/README.md +++ b/README.md @@ -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 ``` diff --git a/flake.nix b/flake.nix index 6ed398c..dc6fe2f 100644 --- a/flake.nix +++ b/flake.nix @@ -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"; diff --git a/packages/goose-cli/package.nix b/packages/goose-cli/package.nix index 5b40757..339411e 100644 --- a/packages/goose-cli/package.nix +++ b/packages/goose-cli/package.nix @@ -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; }; } diff --git a/packages/goose-cli/update.py b/packages/goose-cli/update.py deleted file mode 100755 index 687dc0e..0000000 --- a/packages/goose-cli/update.py +++ /dev/null @@ -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() diff --git a/packages/mcp-gateway/package.nix b/packages/mcp-gateway/package.nix index 7e9c119..4e1618e 100644 --- a/packages/mcp-gateway/package.nix +++ b/packages/mcp-gateway/package.nix @@ -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; }; } diff --git a/packages/skillsmcp/package.nix b/packages/skillsmcp/package.nix index a3f71ce..56f776b 100644 --- a/packages/skillsmcp/package.nix +++ b/packages/skillsmcp/package.nix @@ -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; }; } diff --git a/treefmt.toml b/treefmt.toml new file mode 100644 index 0000000..8c09172 --- /dev/null +++ b/treefmt.toml @@ -0,0 +1,6 @@ +[global] +excluded = ["flake.lock"] + +[formatter.nix] +command = "nixfmt" +includes = ["*.nix"]