nix-test
Run tests and manage .test-status for the tsurf repo
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Menú
Run tests and manage .test-status for the tsurf repo
Instalar con Codex o Claude Copia este prompt, pégalo en Codex, Claude u otro asistente, y deja que revise la página de la skill y la instale por ti.
Basado en la clasificación ocupacional SOC
| name | nix-test |
| description | Run tests and manage .test-status for the tsurf repo |
| user_invocable | true |
Run tests for this repo and manage .test-status for the commit guard.
# Run eval checks (the most common test -- always do this before committing)
nix flake check
# On success, write .test-status for the commit guard hook
nix flake check 2>&1 && echo "pass|0|$(date +%s)" > .test-status
Eval checks (offline, fast, ~30s) -- nix flake check
services and dev hosts.tests/eval/config-checks.nix.VM integration test (requires KVM) -- nix build .#vm-test-sandbox
nix flake check works everywhere.Live tests (SSH to running hosts) -- nix run .#test-live -- --host <hostname>
scripts/run-tests.sh --live --json (one JSON object per test).The commit guard hook (~/.claude/hooks/guard.sh) blocks commits unless .test-status exists at the project root with a recent pass.
pass|0|<unix_timestamp>/data/projects/tsurf/.test-status (project root), not .claude/nix flake check 2>&1 && echo "pass|0|$(date +%s)" > .test-statusnix flake check fails, fix the error first. Do not write .test-status manually without a passing check.In tests/eval/config-checks.nix, use mkCheck:
my-check-name = mkCheck
"my-check-name" # derivation name
"PASS message describing what was verified" # shown on success
"FAIL message describing what went wrong" # shown on failure
(/* boolean condition */);
Access host configs:
servicesCfg -- services hostdevCfg -- dev hostFor source-based checks (verify module content without importing):
my-source-check =
let source = builtins.readFile ../../modules/my-module.nix;
in mkCheck "my-source-check"
"my-module contains expected pattern"
"my-module missing expected pattern"
(lib.hasInfix "expected-string" source);
nix flake check output. The check name (for example firewall-ports-services) maps directly to a derivation in config-checks.nix.git add modules/new-file.nixnetworking.nix assertion fired (for example internal port leaked to public firewall). Check internalOnlyPorts and allowedTCPPorts.default.nix does not import the new module.port = "8090" instead of port = 8090).nix flake check, then update .test-status.Documentation-only changes (README.md, CLAUDE.md, .planning/) do not require nix flake check because they do not affect NixOS evaluation. Running it is still safe and recommended.
Create or update a private tsurf overlay from discovered host facts. Use when an agent needs to author NixOS modules, choose public tsurf role modules, or preserve private services.
Validate a tsurf public repo or private overlay before deployment. Use when an agent is about to run checks, prepare a deploy, override a deploy target, verify rollback/recovery safety, or decide whether a tsurf host change is safe enough to push.
Inspect an existing or prospective NixOS host before applying tsurf. Use when an agent needs to choose a safe tsurf setup path, adapt to unknown disk/network/provider details, determine whether a host can use the public roles directly, or collect facts for a private overlay.
Deploy tsurf NixOS config to a server
Create a new NixOS module for the tsurf repo