/ 目录 / 演练场 / mcp-nixos
● 社区 utensils ⚡ 即开即用

mcp-nixos

作者 utensils · utensils/mcp-nixos

Look up any NixOS package, module option, or Home Manager setting from chat — 130k packages + 23k options, no setup.

mcp-nixos queries NixOS packages, system options, Home Manager, nix-darwin, Nixvim, and related registries through two tools. No auth, no local Nix install required — it proxies to public search APIs. Ideal for answering 'is there a package for X?' and 'what's the option for Y?' without hunting through docs.

为什么要用

核心特性

实时演示

实际使用效果

nixos.replay ▶ 就绪
0/0

安装

选择你的客户端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "nixos": {
      "command": "uvx",
      "args": [
        "mcp-nixos"
      ],
      "_inferred": true
    }
  }
}

打开 Claude Desktop → Settings → Developer → Edit Config。保存后重启应用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "nixos": {
      "command": "uvx",
      "args": [
        "mcp-nixos"
      ],
      "_inferred": true
    }
  }
}

Cursor 使用与 Claude Desktop 相同的 mcpServers 格式。项目级配置优先于全局。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "nixos": {
      "command": "uvx",
      "args": [
        "mcp-nixos"
      ],
      "_inferred": true
    }
  }
}

点击 Cline 侧栏中的 MCP Servers 图标,然后选 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "nixos": {
      "command": "uvx",
      "args": [
        "mcp-nixos"
      ],
      "_inferred": true
    }
  }
}

格式与 Claude Desktop 相同。重启 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "nixos",
      "command": "uvx",
      "args": [
        "mcp-nixos"
      ]
    }
  ]
}

Continue 使用服务器对象数组,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "nixos": {
      "command": {
        "path": "uvx",
        "args": [
          "mcp-nixos"
        ]
      }
    }
  }
}

加入 context_servers。Zed 保存后热重载。

claude mcp add nixos -- uvx mcp-nixos

一行命令搞定。用 claude mcp list 验证,claude mcp remove 卸载。

使用场景

实战用法: mcp-nixos

Find a NixOS package by fuzzy name or purpose

👤 NixOS users, flake authors ⏱ ~5 min beginner

何时使用: You remember roughly what the package does but not its nix attribute name.

步骤
  1. Search
    Find NixOS packages matching 'ocr command line tool'.✓ 已复制
    → Ranked list of candidates with descriptions
  2. Get details on the best fit
    For tesseract, show me the attribute path, version in unstable vs 24.11, and which meta.platforms are supported.✓ 已复制
    → Detail card with attr, versions, platforms

结果: The exact attribute to drop into your configuration.nix or flake.

注意事项
  • Channel mismatch — package only exists in unstable, not your stable channel — Ask explicitly about the channel you're on
搭配使用: filesystem

Look up a NixOS module option with its type and default

👤 People writing NixOS modules ⏱ ~5 min beginner

何时使用: You know there's an option 'somewhere' for enabling zswap and you don't want to grep nixpkgs.

步骤
  1. Query options
    Is there a NixOS option for enabling zswap? Show its type, default, and description.✓ 已复制
    → Full option card
  2. Get an example
    Give me a minimal configuration.nix snippet that enables zswap with z3fold and 20% memory.✓ 已复制
    → Copy-paste Nix snippet

结果: A correct option usage ready to paste in.

Pin nixpkgs to an old version of a package

👤 Users needing a specific older version ⏱ ~10 min intermediate

何时使用: A newer version broke something and you want the last known-good commit.

步骤
  1. Find historical versions
    Show me past versions of nodejs_20 in nixpkgs with commit hashes.✓ 已复制
    → Version→commit table
  2. Generate a flake input
    Generate the flake input pinning nodejs_20 20.15.0 from that commit.✓ 已复制
    → Ready-to-paste flake.nix snippet

结果: A reproducibly pinned input for rollback.

搭配使用: filesystem

Discover Home Manager options for a program

👤 Anyone using Home Manager ⏱ ~10 min beginner

何时使用: You want to manage a program declaratively but aren't sure what options exist.

步骤
  1. List program options
    List every Home Manager option under programs.neovim.✓ 已复制
    → Categorized option list
  2. Build a minimal block
    Give me a minimal programs.neovim block enabling Telescope and LSP for TS/Python.✓ 已复制
    → Working HM snippet

结果: A working Home Manager config without reading the full manual.

组合

与其他 MCP 搭配,撬动十倍杠杆

nixos + filesystem

Find the option and write it into your config file

Find the NixOS option to enable flatpak, then add it to ~/nixos/configuration.nix with a comment.✓ 已复制
nixos + github

Raise an issue when a package is missing

Is package foo-cli in nixpkgs? If not, open a github issue on our fork requesting it.✓ 已复制

工具

此 MCP 暴露的能力

工具输入参数何时调用成本
nix action: search|info|stats|options|channels|flake-inputs|cache, args: ... Any query over packages, options, channels 1 upstream API call
nix_versions package: str Need an older version / nixpkgs pin 1 upstream call

成本与限制

运行它的成本

API 配额
Public APIs; generous limits but not infinite — don't hammer
每次调用 Token 数
Options with descriptions: 500-2000 tokens. Lists can be larger.
费用
Free
提示
Prefer info on one package over search returning 50.

安全

权限、密钥、影响范围

凭据存储: None
数据出站: Calls to search.nixos.org and related public APIs

故障排查

常见错误与修复

uvx not found

Install uv: curl -LsSf https://astral.sh/uv/install.sh | sh, then re-add the MCP.

验证: uvx --version
No results for a package I know exists

Spelling varies in attribute names — try a looser query or search by description.

验证: Retry with partial keyword
Stale version info

The MCP caches briefly; re-query in 5 minutes or pass action=cache to refresh.

替代方案

mcp-nixos 对比其他方案

替代方案何时用它替代权衡
search.nixos.org directlyYou're fine with a browser tabNo AI in the loop
nix-search CLIYou want local fast search and have Nix installedNeeds local Nix + an up-to-date channel

更多

资源

📖 阅读 GitHub 上的官方 README

🐙 查看未解决的 issue

🔍 浏览全部 400+ MCP 服务器和 Skills