一键导入
update
Update flake inputs (nixpkgs, home-manager) and handle compatibility. Use when asked to update dependencies, upgrade, refresh flake lock, or bump nixpkgs.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Update flake inputs (nixpkgs, home-manager) and handle compatibility. Use when asked to update dependencies, upgrade, refresh flake lock, or bump nixpkgs.
用 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.
Safely rebuild and deploy the NixOS system. Use when asked to rebuild, switch, deploy, apply configuration, or activate changes.
| name | update |
| description | Update flake inputs (nixpkgs, home-manager) and handle compatibility. Use when asked to update dependencies, upgrade, refresh flake lock, or bump nixpkgs. |
# 1. 准备
git status
nix flake metadata --json | jq '{nixpkgs, home-manager: .locks.nodes.home-manager.locked}'
# 2. 更新
nix flake update --flake /etc/nixos
# 或单 input: nix flake lock --update-input nixpkgs --flake /etc/nixos
# 3. 检查 diff
git diff flake.lock
# 4. Eval 验证
nix flake check
# 5. 构建验证
nixos-rebuild build --flake /etc/nixos#<machine>
# 6. 应用
sudo nixos-rebuild switch --flake /etc/nixos#<machine>
# 7. 提交
git add flake.lock
git commit -m "chore: update flake lock"
| 症状 | 处理 |
|---|---|
attribute 'xxx' missing | 搜索 nixpkgs 替代品;更新引用 |
option 'xxx' renamed to 'yyy' | 按警告更新选项名 |
| 覆盖层失效 | 检查上游是否修复 → 移除/调整覆盖 |
| 弹性包解析断裂 | 用 modules/lib.nix 的 resolvePkg 替代手动 tryEval |
git checkout HEAD~1 -- flake.lock
sudo nixos-rebuild switch --flake /etc/nixos#<machine>
更新时机:定期维护、需要新版本包功能、安全修复 不更新时机:系统刚稳定、正在做其他重构、nixpkgs-unstable 大面积 breaking change