nixcf-deploy

Plans, validates, deploys, verifies, and rolls back NixOS flake hosts with staged authorization gates.

Updated Jun 23, 2024
One-click install
npx skills add https://github.com/lifeich1/nixcf --skill nixcf-deploy-lifeich1
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: nixcf-deploy
Source: https://github.com/lifeich1/nixcf/tree/main/.agents/skills/nixcf-deploy
Command: npx skills add https://github.com/lifeich1/nixcf --skill nixcf-deploy-lifeich1

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Deploying NixOS configurations to remote hosts carries real risk: a failed switch can break connectivity, a Git tag can misrepresent a dirty working tree, and a partial multi-host rollout can leave machines in inconsistent states. This Skill enforces a staged, authorization-gated deployment workflow for the nixcf flake so every live action is deliberate, verified, and recoverable. ## Core Features & Use Cases - Staged operation classification: Distinguishes plan, validate, build, test activation, local switch, remote switch, multi-host rollout, rollback, and tagging, each requiring explicit authorization before execution. - Preflight provenance checks: Inspects Git status, HEAD, dirty-tree state, and flake.lock/secrets/ changes, and runs a source-safety gate before any Nix evaluation or deployment. - Verification and rollback: Verifies activation, fresh connectivity, systemd health, changed units, and application checks after switching, and defines exact generation-based rollback commands before any live change. - Use Case: You edited the Pi4B homelab configuration and want to deploy. The Skill reads flake.nix and justfile, confirms the target and recipe semantics, runs just chk, records the current generation, executes just pi only after you authorize both the switch and its automatic pi-r<N> tag, then verifies system health and reports the per-host result state. ## Quick Start Use the nixcf-deploy skill to validate the flake with just chk and then deploy the nixos-pi4b host, asking me for confirmation before the remote switch and tag.

Frequently Asked Questions about nixcf-deploy

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I safely deploy a NixOS flake to a remote host?▼

Read the flake registry and justfile recipes, run Git provenance checks and just chk, record the current generation, then execute the authorized nixos-rebuild switch command. Verify activation, fresh connectivity, and systemd health afterward, and keep a defined rollback path ready.

How do I roll back a failed NixOS deployment?▼

Identify the generation recorded before the switch and reactivate it with an explicit nixos-rebuild command targeting that generation. Do not rely on nixos-rebuild --rollback when multiple switches occurred, and re-verify generation, connectivity, and service health after rolling back.

What is the difference between nixos-rebuild test and switch?▼

nixos-rebuild test activates the configuration until reboot without making it the boot default, but it is still a live activation requiring authorization. nixos-rebuild switch activates the configuration and updates the system profile as the new boot default.

Why should I not tag a deployment from a dirty Git working tree?▼

A Git tag points to a commit, but a path-based flake can build uncommitted working-tree changes the tag does not capture. Tagging a dirty tree creates provenance that misrepresents what was actually deployed, so commit or clean changes first.

Does a successful nix flake check prove a deployment will work?▼

No. Evaluation and closure construction do not prove bootability, network connectivity, service health, or successful activation. Live verification of the active generation, fresh connections, failed units, and application health is required after switching.

What happens if a NixOS switch succeeds but the deployment tag fails?▼

The result is classified as deployed but untagged, which is a partial state. Do not redeploy just to obtain a tag or invent one; stop, report the state, and let the user decide how to proceed.