diff --git a/infrastructure/nixos/modules/deploy.nix b/infrastructure/nixos/modules/deploy.nix index 809ef353..a2193267 100644 --- a/infrastructure/nixos/modules/deploy.nix +++ b/infrastructure/nixos/modules/deploy.nix @@ -25,7 +25,7 @@ let # Notify via the notification service ${pkgs.curl}/bin/curl -s -X POST http://localhost:9001/event \ -H "Content-Type: application/json" \ - -d "{\"type\":\"deploy.nixos-changed\",\"title\":\"NixOS config changed in $SHA\",\"status\":\"warning\",\"details\":\"Manual apply required: bun run cli nixos apply\"}" \ + -d "{\"type\":\"deploy.nixos-changed\",\"title\":\"NixOS config changed in $SHA\",\"status\":\"failure\",\"details\":\"Manual apply required: bun run cli nixos apply\"}" \ || true else echo "No NixOS config changes" diff --git a/scripts/smoke-check.ts b/scripts/smoke-check.ts index e2216232..42c8acd4 100644 --- a/scripts/smoke-check.ts +++ b/scripts/smoke-check.ts @@ -37,9 +37,9 @@ const checks: Check[] = [ }, }, { - name: 'Auth guard protects /projects', + name: 'Auth guard protects /new', async run() { - const res = await fetch(`${baseUrl}/projects`, { redirect: 'manual' }) + const res = await fetch(`${baseUrl}/new`, { redirect: 'manual' }) if (res.status !== 302) throw new Error(`Expected 302, got ${res.status}`) const location = res.headers.get('Location') ?? '' if (!location.includes('/auth/signin')) diff --git a/src/entrypoints/cli/commands/nixos.ts b/src/entrypoints/cli/commands/nixos.ts index eb905b57..a443e413 100644 --- a/src/entrypoints/cli/commands/nixos.ts +++ b/src/entrypoints/cli/commands/nixos.ts @@ -151,6 +151,9 @@ export async function nixos(args: string[]): Promise { `git config --global --add safe.directory ${worktree} 2>/dev/null || true`, `cd ${worktree}`, `nixos-rebuild switch --flake ./infrastructure/nixos#${flakeTarget}`, + // Record the applied config in /etc/nixos: forms-lab-deploy-main + // diffs against it to decide whether a manual apply is pending. + `cp -rT ./infrastructure/nixos /etc/nixos`, ].join(' && '), )