Token导航 LogoToken导航TokenDH.com
开发规范只读github未标认证来源可访问clear审计提醒

nixos-best-practices尼克斯最佳实践

Agent Skill

nixos-best-practices 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

2,350

周安装

96

GitHub Stars

2

下载量

760
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:nixos-best-practices(尼克斯最佳实践)
来源仓库:https://github.com/lihaoze123/my-skills
仓库路径:skills/nixos-best-practices
安装命令:
npx skills add https://github.com/lihaoze123/my-skills --skill nixos-best-practices
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/lihaoze123/my-skills --skill nixos-best-practices

简介

nixos-best-practices 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中整理仓库状态与协作事项。

  • 适用于围绕代码变更、项目进度或团队协作进行信息梳理的场景。
  • 通过 npx skills add 命令从 GitHub 仓库安装,需确认权限与维护状态。
  • 使用前应核实是否会触发联网、命令执行或文件读写操作。
  • 建议结合原始 README 和仓库路径进一步了解具体功能与限制。

SKILL.md

Configuring NixOS Systems with Flakes

Configure NixOS systems with flakes, manage overlays properly, and structure configurations for maintainability.

⚠️ CRITICAL: Read Before Making Changes

BEFORE making ANY NixOS configuration changes, you MUST:

  1. Review relevant rule files from the Quick Reference below
  2. Check common-mistakes.md to avoid known pitfalls
  3. Check troubleshooting.md for systematic debugging approach
  4. Follow existing patterns in the codebase

Do NOT start coding until you've read the applicable documentation.

Most configuration errors happen from not reading the rules first. The 5 minutes you spend reading will save hours of debugging.

Red Flags - STOP BEFORE CODING

  • "I can just try this option" → Check if it exists in nixpkgs/Home Manager first
  • "Let me experiment with different approaches" → Read the docs, don't guess
  • "This should work" → Verify syntax and availability in nixpkgs
  • Making multiple rebuild attempts → You're missing systematic debugging
  • "I remember this works" → Docs change, verify current approach

Core Principle

Understand the interaction between NixOS system configuration and Home Manager overlays.

When useGlobalPkgs = true, overlays must be defined at the NixOS configuration level, not in Home Manager configuration files.

When to Use

  • Configuring NixOS with flakes and Home Manager
  • Adding overlays that don't seem to apply
  • Using useGlobalPkgs = true with custom overlays
  • Structuring NixOS configurations across multiple hosts
  • Package changes not appearing after rebuild
  • Confused about where to define overlays

Don't use for:

  • Packaging new software (use nix-packaging-best-practices)
  • Simple package installation without overlays
  • NixOS module development (see NixOS module documentation)

Quick Reference

TopicRule File
Overlay scope and useGlobalPkgsoverlay-scope
Flakes configuration structureflakes-structure
Host configuration organizationhost-organization
Package installation best practicespackage-installation
Common configuration mistakescommon-mistakes
Debugging configuration issuestroubleshooting

Essential Pattern: Overlay with useGlobalPkgs

# ❌ WRONG: Overlay in home.nix (doesn't apply)
# home-manager/home.nix
{
  nixpkgs.overlays = [ inputs.claude-code.overlays.default ];  # Ignored!
  home.packages = with pkgs; [ claude-code ];  # Not found!
}

# ✅ CORRECT: Overlay in NixOS home-manager block
# hosts/home/default.nix
{
  home-manager.useGlobalPkgs = true;
  home-manager.useUserPackages = true;
  home-manager.users.chumeng = import ./home.nix;
  home-manager.extraSpecialArgs = { inherit inputs pkgs-stable system; };
  # Overlay must be HERE when useGlobalPkgs = true
  nixpkgs.overlays = [ inputs.claude-code.overlays.default ];
}

Common Tasks

TaskSolution
Add flake inputAdd to inputs in flake.nix
Add overlay for system packagesDefine in nixpkgs.overlays in system configuration
Add overlay for home-manager (useGlobalPkgs=true)Define in home-manager.nixpkgs.overlays in host config
Add overlay for home-manager (useGlobalPkgs=false)Define in home.nix with nixpkgs.overlays
Pass inputs to modulesUse specialArgs in nixosSystem or home-manager
Multiple host configurationsCreate separate host files in hosts/
Shared configuration modulesCreate modules in modules/ and import in each host
Package not found after overlayCheck overlay scope vs useGlobalPkgs setting

Overlay Scope Decision Matrix

useGlobalPkgsOverlay Definition LocationAffects
truehome-manager.nixpkgs.overlaysSystem + Home Manager packages
truehome.nix with nixpkgs.overlaysNothing (ignored!)
falsehome.nix with nixpkgs.overlaysHome Manager packages only
falsehome-manager.nixpkgs.overlaysHome Manager packages only
AnySystem nixpkgs.overlaysSystem packages only

Configuration Layers (Bottom to Top)

  1. System configuration (/etc/nixos/configuration.nix or host files)

- System-wide services - System packages - System overlays only affect this layer

  1. Home Manager (useGlobalPkgs=true)

- Uses system pkgs (includes system overlays) - Home Manager overlays affect both system and user packages - Most efficient for single-user systems

  1. Home Manager (useGlobalPkgs=false)

- Creates separate pkgs instance - Home Manager overlays affect user packages only - Useful for multi-user systems with different needs

Red Flags - STOP

  • "Overlay in home.nix isn't working" → Check if useGlobalPkgs=true, move to host config
  • "I'll just add overlays everywhere" → Define once at appropriate scope
  • "Package works in nix repl but not installed" → Check overlay scope
  • "Changes don't apply after rebuild" → Verify overlay is in correct location
  • "useGlobalPkgs=false for no reason" → Use true unless you need separate package sets

How to Use

Read individual rule files for detailed explanations and code examples:

rules/overlay-scope.md       # The core overlay scope issue
rules/flakes-structure.md    # How to organize flake.nix
rules/host-organization.md   # How to structure host configs
rules/common-mistakes.md     # Pitfalls and how to avoid them

Each rule file contains:

  • Brief explanation of why it matters
  • Incorrect code example with explanation
  • Correct code example with explanation
  • Additional context and references

Full Compiled Document

For the complete guide with all rules expanded: AGENTS.md

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenCode

27.14%
按下载量换算206

Gemini CLI

19.16%
按下载量换算146

Claude Code

17.71%
按下载量换算135

Cursor

12.9%
按下载量换算98

Antigravity

7.82%
按下载量换算59

windsurf

3.49%
按下载量换算27

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

只读

该 Skill 主要提供规则、说明或参考内容,本身偏只读;真正读写文件、联网或执行命令仍取决于宿主 Agent 的任务。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills