Loading...
Loading...
Compare original and translation side by side
| Task | Go to |
|---|---|
| Rebuild / activate / rollback system | vm-management.md |
| Install NixOS on new machine | installation.md |
| Build ISO / disk image / VM image | image-building.md |
| Configure modules, flakes, packages, services | configuration.md |
| Ephemeral root / wipe on boot / impermanence | impermanence.md |
| LUKS encryption / remote unlock (SSH, Tailscale) | luks.md |
| Health checks / Telegram (or webhook) alerts for filesystem, disk, SMART, services | monitoring.md |
| Something isn't working / weird behavior | anti-patterns.md |
| 任务 | 查看文档 |
|---|---|
| 重建/激活/回滚系统 | vm-management.md |
| 在新机器上安装NixOS | installation.md |
| 构建ISO/磁盘镜像/VM镜像 | image-building.md |
| 配置模块、flakes、软件包、服务 | configuration.md |
| 临时根目录/开机重置/无持久化存储 | impermanence.md |
| LUKS加密/远程解锁(SSH、Tailscale) | luks.md |
| 文件系统、磁盘、SMART、服务的健康检查/Telegram(或Webhook)告警 | monitoring.md |
| 功能异常/奇怪行为排查 | anti-patterns.md |
nixos-rebuildNixOS machine: edit → nixos-rebuild switch (local)nixos-optionman configuration.nixnixos-rebuildNixOS workstation (edit) → nixos-rebuild --target-host → NixOS servernixos-rebuildnixos-optionmacOS (edit .nix files) → push/rsync → NixOS Linux host → nixos-rebuild switch (local)nixos-rebuildnixos-optionsearch.nixos.org/optionsmacOS (edit) → nixos-rebuild --target-host root@linux-host --flake .#hostnixos-rebuildnixnix evalsearch.nixos.orgUbuntu/Debian/Arch (edit + run nixos-rebuild) → NixOS remote servernixos-optionnix evalsearch.nixos.orgCI agent (GitHub Actions / GitLab CI) → deploy to NixOS servercachix/install-nix-actionnix flake checkNixOS机器:编辑配置 → 本地执行nixos-rebuild switchnixos-optionman configuration.nixnixos-rebuildNixOS工作站(编辑配置) → 执行nixos-rebuild --target-host → NixOS服务器nixos-rebuildnixos-optionmacOS(编辑.nix文件) → 推送/rsync → NixOS Linux主机 → 本地执行nixos-rebuild switchnixos-rebuildnixos-optionsearch.nixos.org/optionsmacOS(编辑配置) → 执行nixos-rebuild --target-host root@linux-host --flake .#hostnixos-rebuildnixnix evalsearch.nixos.orgUbuntu/Debian/Arch(编辑配置+运行nixos-rebuild) → NixOS远程服务器nixos-optionnix evalsearch.nixos.orgCI代理(GitHub Actions / GitLab CI) → 部署到NixOS服务器cachix/install-nix-actionnix flake check| Machine | | | | |
|---|---|---|---|---|
| NixOS host | ✅ | ✅ | ✅ | ✅ |
| macOS with Nix | ❌ | ✅ | ❌ | ✅ |
| Linux (non-NixOS) with Nix | ❌ | ✅ | ❌ | ✅ |
| macOS without Nix | ❌ | ❌ | ❌ | ✅ |
| CI agent with Nix | ❌ | ✅ | ❌ | ✅ |
| 机器类型 | | | | |
|---|---|---|---|---|
| NixOS主机 | ✅ | ✅ | ✅ | ✅ |
| 安装Nix的macOS | ❌ | ✅ | ❌ | ✅ |
| 安装Nix的非NixOS Linux | ❌ | ✅ | ❌ | ✅ |
| 未安装Nix的macOS | ❌ | ❌ | ❌ | ✅ |
| 安装Nix的CI代理 | ❌ | ✅ | ❌ | ✅ |
mcp-nixosmcp-nixosmcp-nixossearch.nixos.orgnixos-optionnixnix_versionsmcp-nixosgit clone https://github.com/utensils/mcp-nixosuvx --from mcp-nixos --printpip download mcp-nixos --no-deps~/.ssh~/.awspyproject.tomlsetup.pymcp-nixossearch.nixos.orgnixos-optionnixnix_versionsmcp-nixosgit clone https://github.com/utensils/mcp-nixosuvx --from mcp-nixos --printpip download mcp-nixos --no-deps~/.ssh~/.awspyproject.tomlsetup.pymcp-nixosundefinedmcp-nixosundefined
**Or use the web** (version-specific, always available):
- `https://search.nixos.org/options` — search by option name, filterable by channel
- Check the channel matching your `nixpkgs.url` (e.g. `nixos-25.05`)
**Workflow when unsure about an option:**
1. Check `search.nixos.org/options` for the option name and correct path
2. Note the NixOS version it applies to
3. Only then include it in configuration
**或使用网页工具**(按版本区分,始终可用):
- `https://search.nixos.org/options` — 按配置项名称搜索,可按频道筛选
- 选择与你的`nixpkgs.url`匹配的频道(例如`nixos-25.05`)
**不确定配置项时的工作流程:**
1. 在`search.nixos.org/options`上查询配置项名称和正确路径
2. 记录该配置项适用的NixOS版本
3. 确认无误后再将其添加到配置中.nixgit addnixos-rebuild testnixos-rebuild switch.nixgit addnixos-rebuild testnixos-rebuild switchnix.settings.experimental-features = [ "nix-command" "flakes" ];nix.settings.experimental-features = [ "nix-command" "flakes" ];nixos-rebuildnixos-rebuild| Command | When to use |
|---|---|
| Apply + set as default boot |
| Apply now, skip bootloader — safe first step |
| Set as next boot without activating now |
| Preview changes without applying |
| Build only, creates |
| Build QEMU VM for local testing |
nixos-rebuild test --flake .#hostname --target-host root@server
nixos-rebuild switch --flake .#hostname --target-host root@server| 命令 | 使用场景 |
|---|---|
| 应用配置并设置为默认引导项 |
| 立即应用配置,不修改引导加载项 — 安全的测试步骤 |
| 设置为下次引导项,但不立即激活 |
| 预览变更但不实际应用 |
| 仅构建系统,生成 |
| 构建QEMU虚拟机用于本地测试 |
nixos-rebuild test --flake .#hostname --target-host root@server
nixos-rebuild switch --flake .#hostname --target-host root@server| Tool | Best for |
|---|---|
| 1-3 machines, simplest |
| Small fleet, auto-rollback on failure |
| Large fleet, parallel, cross-host config |
| Initial install on non-NixOS machine |
| 工具 | 最佳适用场景 |
|---|---|
| 1-3台机器,最简单的方式 |
| 小型机器集群,失败时自动回滚 |
| 大型机器集群,支持并行部署、跨主机配置 |
| 在非NixOS机器上初始安装NixOS |
| Tool | When to use |
|---|---|
| agenix | Simple setup, SSH key workflow, small secret count |
| sops-nix | Cloud KMS needed, templating, multiple formats |
/run/agenix//run/secrets/| 工具 | 使用场景 |
|---|---|
| agenix | 配置简单,基于SSH密钥工作流,密钥数量较少的场景 |
| sops-nix | 需要云KMS、模板化支持、多格式密钥的场景 |
/run/agenix//run/secrets/environment.systemPackagesusers.users.<name>networking.*services.*boot.loader.*nix.settings.*environment.systemPackagesusers.users.<name>networking.*services.*boot.loader.*nix.settings.*