pull-update: improvement
All checks were successful
Build / build (push) Successful in 3m0s
All checks were successful
Build / build (push) Successful in 3m0s
This commit is contained in:
@@ -3,7 +3,15 @@
|
|||||||
# records the output store path at /deploy/<hostname>. On boot this
|
# records the output store path at /deploy/<hostname>. On boot this
|
||||||
# service fetches that path, pulls the closure from the binary cache,
|
# service fetches that path, pulls the closure from the binary cache,
|
||||||
# sets it as the boot profile, and reboots into it.
|
# 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
|
let
|
||||||
deploy-url = "https://nix-cache.sigkill.computer/deploy/${hostname}";
|
deploy-url = "https://nix-cache.sigkill.computer/deploy/${hostname}";
|
||||||
|
|
||||||
@@ -43,14 +51,19 @@ let
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
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-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; }
|
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; }
|
"$STORE_PATH/bin/switch-to-configuration" boot || { echo "Failed to install boot entry"; exit 1; }
|
||||||
|
|
||||||
wall "System update installed. Rebooting in 10 seconds..."
|
echo ""
|
||||||
sleep 10
|
echo "Update installed. Rebooting..."
|
||||||
|
echo ""
|
||||||
systemctl reboot
|
systemctl reboot
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
@@ -60,11 +73,15 @@ in
|
|||||||
description = "Pull latest NixOS configuration from binary cache";
|
description = "Pull latest NixOS configuration from binary cache";
|
||||||
after = [ "network-online.target" ];
|
after = [ "network-online.target" ];
|
||||||
wants = [ "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" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
restartIfChanged = false;
|
restartIfChanged = false;
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
ExecStart = lib.getExe pull-update;
|
ExecStart = lib.getExe pull-update;
|
||||||
|
StandardOutput = "journal+console";
|
||||||
|
StandardError = "journal+console";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user