template2: revert to journal+console output for bootstrap
Some checks failed
Run nix flake check / flake-check (push) Failing after 1s

TTY output was causing nixos-rebuild to fail. Keep the custom
greeting line to indicate bootstrap image, but use journal+console
for reliable logging.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-02-07 15:24:39 +01:00
parent 4ca3c8890f
commit 11261c4636

View File

@@ -2,12 +2,10 @@
let
bootstrap-script = pkgs.writeShellApplication {
name = "nixos-bootstrap";
runtimeInputs = with pkgs; [ systemd curl nixos-rebuild jq git ncurses ];
runtimeInputs = with pkgs; [ systemd curl nixos-rebuild jq git ];
text = ''
set -euo pipefail
# Clear screen and show bootstrap banner
clear
echo "================================================================================"
echo " NIXOS BOOTSTRAP IN PROGRESS"
echo "================================================================================"
@@ -110,11 +108,6 @@ in
Check status: journalctl -fu nixos-bootstrap
'';
# Disable getty on tty1 so bootstrap output is visible
systemd.services."getty@tty1" = {
enable = false;
};
systemd.services."nixos-bootstrap" = {
description = "Bootstrap NixOS configuration from flake on first boot";
@@ -134,12 +127,9 @@ in
# Read environment variables from cloud-init (set by cloud-init write_files)
EnvironmentFile = "-/run/cloud-init-env";
# Output to tty1 for visibility on console
StandardOutput = "tty";
StandardError = "tty";
TTYPath = "/dev/tty1";
TTYReset = true;
TTYVHangup = true;
# Log to journal and console
StandardOutput = "journal+console";
StandardError = "journal+console";
};
};
}