一键导入
rebuild
Safely rebuild and deploy the NixOS system. Use when asked to rebuild, switch, deploy, apply configuration, or activate changes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Safely rebuild and deploy the NixOS system. Use when asked to rebuild, switch, deploy, apply configuration, or activate changes.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Create or edit NixOS/Home Manager modules. Use when asked to create modules, add new modules, split modules, or manage the module architecture.
Manage system and user software packages, profiles, and overlays. Use when asked to install, add, remove, change software, enable/disable profiles, or manage Flatpak apps.
Refactor NixOS configuration — extract modules, clean up, remove dead code, consolidate duplicates. Use when asked to refactor, split, clean, reorganize, optimize, or consolidate Nix config.
Validate, build, and deploy the NixOS configuration. Use when asked to run, build, check, validate, verify, test, or deploy the NixOS config.
Manage NixOS users — add, remove, or modify user configurations. Use when asked to add users, create users, manage users, set up multi-user, or configure profiles and dotfiles.
Debug Nix build failures, eval errors, and runtime issues. Use when asked to debug, fix errors, troubleshoot, diagnose build/eval failures, greetd crashes, or systemd failed services.
| name | rebuild |
| description | Safely rebuild and deploy the NixOS system. Use when asked to rebuild, switch, deploy, apply configuration, or activate changes. |
.claude/skills/run-nixos-config/validate.sh
nix flake check # 完整 eval 检查(失败则停止!)
git status # 确认新增 tracked 文件已 git add
验证脚本先检查所有可部署机器都有已跟踪的 machines/<machine>/hardware-configuration.nix(排除仅求值的 ci 和 _template),再从当前 checkout 完整求值。它不依赖 /etc/nixos 中私有的 local.nix 或 hardware-gpu.nix。
当前机器:
nixos-rebuild build --flake /etc/nixos#nixos
其他机器将 nixos 替换为实际 flake 输出名 <machine>;不要使用 host、default 或主机名猜测输出。失败 → 进入 /debug。
sudo nixos-rebuild switch --flake /etc/nixos#nixos
部署其他机器时同样使用实际的 /etc/nixos#<machine> 输出;ci 仅求值,不可切换。
systemctl --failed # 检查失败服务
journalctl -u greetd -b # 检查登录管理器
nix flake check 失败时 switchswitchboot 而非 switch(重启后生效)stateVersion → 警告用户不要改sudo nixos-rebuild list-generations
sudo nixos-rebuild switch --rollback
nixos-rebuild build --flake /etc/nixos#nixos # 只构建
sudo nixos-rebuild boot --flake /etc/nixos#nixos # 下次重启生效
nixos-rebuild build-vm --flake /etc/nixos#nixos # VM 测试
nix flake check # 只检查