feature/hm-options #2

Merged
torjus merged 4 commits from feature/hm-options into master 2026-02-03 22:40:08 +00:00
Owner

Summary

Add a new hm-options MCP server for Home Manager options, mirroring the functionality of nixos-options but
targeting the home-manager repository instead of nixpkgs.

Changes

New Components

  • internal/homemanager/ - Home Manager indexer with channel aliases (hm-unstable, hm-stable,
    release-24.11, etc.)
  • internal/options/ - Shared Indexer interface used by both implementations
  • cmd/hm-options/ - CLI entry point with identical interface to nixos-options
  • nix/hm-options-module.nix - NixOS module for systemd deployment

Modified Components

  • internal/mcp/server.go - Added ServerConfig to parameterize server name, instructions, and default
    channel
  • internal/mcp/handlers.go - Accept options.Indexer interface instead of concrete *nixos.Indexer
  • nix/package.nix - Parameterized for building both packages
  • flake.nix - Added hm-options package and hm-options-mcp NixOS module

Documentation

  • Updated README.md with hm-options usage examples
  • Updated CLAUDE.md with new structure, version bump rules, and nix build requirements

Version Bump

  • 0.1.0 → 0.1.1 (patch bump for internal/ changes)

Usage

# Build                                                                                                       
nix build .#hm-options                                                                                        
                                                                                                              
# Index and search                                                                                            
nix run .#hm-options -- index hm-unstable                                                                     
nix run .#hm-options -- search "programs.git"                                                                 
nix run .#hm-options -- get programs.git.enable                                                               
                                                                                                              
# Run MCP server                                                                                              
nix run .#hm-options -- serve                                                                                 
                                                                                                              
MCP Client Configuration                                                                                      
                                                                                                              
{                                                                                                             
  "mcpServers": {                                                                                             
    "hm-options": {                                                                                           
      "command": "nix",                                                                                       
      "args": ["run", "git+https://git.t-juice.club/torjus/labmcp#hm-options", "--", "serve"],                
      "env": {                                                                                                
        "HM_OPTIONS_DATABASE": "sqlite:///path/to/hm-options.db"                                              
      }                                                                                                       
    }                                                                                                         
  }                                                                                                           
}                                                                                                             
                                                                                                              
Security                                                                                                      
                                                                                                              
- Uses same input validation pattern as nixos-options (strict regex for revision strings)                     
- Prevents Nix injection, path traversal, and shell metacharacter attacks                                     
- No new attack surface introduced  
## Summary Add a new `hm-options` MCP server for Home Manager options, mirroring the functionality of `nixos-options` but targeting the home-manager repository instead of nixpkgs. ## Changes ### New Components - **`internal/homemanager/`** - Home Manager indexer with channel aliases (`hm-unstable`, `hm-stable`, `release-24.11`, etc.) - **`internal/options/`** - Shared `Indexer` interface used by both implementations - **`cmd/hm-options/`** - CLI entry point with identical interface to `nixos-options` - **`nix/hm-options-module.nix`** - NixOS module for systemd deployment ### Modified Components - **`internal/mcp/server.go`** - Added `ServerConfig` to parameterize server name, instructions, and default channel - **`internal/mcp/handlers.go`** - Accept `options.Indexer` interface instead of concrete `*nixos.Indexer` - **`nix/package.nix`** - Parameterized for building both packages - **`flake.nix`** - Added `hm-options` package and `hm-options-mcp` NixOS module ### Documentation - Updated README.md with hm-options usage examples - Updated CLAUDE.md with new structure, version bump rules, and nix build requirements ### Version Bump - 0.1.0 → 0.1.1 (patch bump for internal/ changes) ## Usage ```bash # Build nix build .#hm-options # Index and search nix run .#hm-options -- index hm-unstable nix run .#hm-options -- search "programs.git" nix run .#hm-options -- get programs.git.enable # Run MCP server nix run .#hm-options -- serve MCP Client Configuration { "mcpServers": { "hm-options": { "command": "nix", "args": ["run", "git+https://git.t-juice.club/torjus/labmcp#hm-options", "--", "serve"], "env": { "HM_OPTIONS_DATABASE": "sqlite:///path/to/hm-options.db" } } } } Security - Uses same input validation pattern as nixos-options (strict regex for revision strings) - Prevents Nix injection, path traversal, and shell metacharacter attacks - No new attack surface introduced
torjus added 2 commits 2026-02-03 22:13:49 +00:00
Add a new MCP server for Home Manager options, mirroring the
functionality of nixos-options but targeting the home-manager
repository.

Changes:
- Add shared options.Indexer interface for both implementations
- Add internal/homemanager package with indexer and channel aliases
- Add cmd/hm-options CLI entry point
- Parameterize MCP server with ServerConfig for name/instructions
- Parameterize nix/package.nix for building both packages
- Add hm-options package and NixOS module to flake.nix
- Add nix/hm-options-module.nix for systemd deployment

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add hm-options documentation to README.md
- Update CLAUDE.md with hm-options info, repository structure
- Add note about git-tracking new files before nix build/run
- Add version bump rules documentation
- Bump version from 0.1.0 to 0.1.1 (patch bump for internal/ changes)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
torjus added 2 commits 2026-02-03 22:37:50 +00:00
The options.json parser expected declarations as []string (NixOS format),
but Home Manager uses [{name, url}] objects. This caused most HM options
to be silently skipped during parsing (27 vs 4880 options).

Changes:
- Parse declarations as json.RawMessage and try both formats
- Handle HM path format <home-manager/modules/...> in normalizeDeclarationPath
- Add /modules/ marker for HM store paths

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Document expected indexing times so appropriate timeouts are used:
- nixos-options: ~5-6 minutes for nixos-unstable
- hm-options: ~1-2 minutes for master

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
torjus merged commit 1fc9f71c48 into master 2026-02-03 22:40:08 +00:00
torjus deleted branch feature/hm-options 2026-02-03 22:40:08 +00:00
This repo is archived. You cannot comment on pull requests.
No Reviewers
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: torjus/labmcp#2