From 5997c886f609dc6f0211f4e9d2dab558ac3a5483 Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 16 Apr 2026 17:43:35 -0400 Subject: [PATCH] pull-update: improvement --- system/pull-update.nix | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/system/pull-update.nix b/system/pull-update.nix index 07c53fa..5bf03ed 100644 --- a/system/pull-update.nix +++ b/system/pull-update.nix @@ -3,7 +3,15 @@ # records the output store path at /deploy/. On boot this # service fetches that path, pulls the closure from the binary cache, # sets it as the boot profile, and reboots into it. -{ pkgs, hostname, lib, ... }: +# +# Runs before the display manager so the user sees progress on the +# console instead of staring at a frozen Steam loading screen. +{ + pkgs, + hostname, + lib, + ... +}: let deploy-url = "https://nix-cache.sigkill.computer/deploy/${hostname}"; @@ -43,14 +51,19 @@ let exit 0 fi - echo "Update available: $CURRENT -> $STORE_PATH" + echo "" + echo "=====================================" + echo " System update available. Installing." + echo "=====================================" + echo "" nix-store -r "$STORE_PATH" || { echo "Failed to fetch closure"; exit 1; } nix-env -p /nix/var/nix/profiles/system --set "$STORE_PATH" || { echo "Failed to set profile"; exit 1; } "$STORE_PATH/bin/switch-to-configuration" boot || { echo "Failed to install boot entry"; exit 1; } - wall "System update installed. Rebooting in 10 seconds..." - sleep 10 + echo "" + echo "Update installed. Rebooting..." + echo "" systemctl reboot ''; }; @@ -60,11 +73,15 @@ in description = "Pull latest NixOS configuration from binary cache"; after = [ "network-online.target" ]; wants = [ "network-online.target" ]; + # run before the display manager so the message is visible on the console + before = [ "display-manager.service" ]; wantedBy = [ "multi-user.target" ]; restartIfChanged = false; serviceConfig = { Type = "oneshot"; ExecStart = lib.getExe pull-update; + StandardOutput = "journal+console"; + StandardError = "journal+console"; }; }; }