mirror of
https://github.com/tomasriveral/nixos.git
synced 2026-08-12 10:30:44 +02:00
flake: autoupdate 2026-05-15T12-57-04Z
This commit is contained in:
@@ -19,23 +19,32 @@ pkgs.writeShellApplication {
|
|||||||
FLAKE="$FLAKE_DIR#laptop"
|
FLAKE="$FLAKE_DIR#laptop"
|
||||||
TIME=$(date -u +"%Y-%m-%dT%H-%M-%SZ")
|
TIME=$(date -u +"%Y-%m-%dT%H-%M-%SZ")
|
||||||
|
|
||||||
git -C "$FLAKE_DIR" pull
|
ERROR_FILE=$(mktemp)
|
||||||
git -C "$FLAKE_DIR" tag "pre-autoupdate-$TIME"
|
|
||||||
|
|
||||||
nix flake update --flake "$FLAKE_DIR"
|
if sudo nixos-rebuild switch --flake "$FLAKE" 2> "$ERROR_FILE"; then
|
||||||
|
|
||||||
if sudo nixos-rebuild switch --flake "$FLAKE"; then
|
|
||||||
git -C "$FLAKE_DIR" restore .
|
git -C "$FLAKE_DIR" restore .
|
||||||
git -C "$FLAKE_DIR" add flake.lock
|
git -C "$FLAKE_DIR" add flake.lock
|
||||||
git -C "$FLAKE_DIR" commit -m "flake: autoupdate $TIME"
|
git -C "$FLAKE_DIR" commit -m "flake: autoupdate $TIME"
|
||||||
git -C "$FLAKE_DIR" push
|
git -C "$FLAKE_DIR" push
|
||||||
|
|
||||||
notify-send "Flake autoupdate" "Rebuild OK"
|
notify-send "Flake autoupdate" "Rebuild OK"
|
||||||
matrix-commander-rs -m "Flake rebuild succesfull.<br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" --html -r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU"
|
|
||||||
|
matrix-commander-rs -m "Flake rebuild succesfull.<br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \
|
||||||
|
--html \
|
||||||
|
-r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU"
|
||||||
|
|
||||||
else
|
else
|
||||||
|
ERROR_MSG=$(cat "$ERROR_FILE")
|
||||||
|
|
||||||
notify-send -u critical "Flake autoupdate" "FAILED"
|
notify-send -u critical "Flake autoupdate" "FAILED"
|
||||||
matrix-commander-rs -m "Flake rebuild FAILED"
|
|
||||||
git reset --hard "pre-autoupdate-$TIME"
|
matrix-commander-rs -m "Flake rebuild failed.<br>Error: <pre>$ERROR_MSG</pre><br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \
|
||||||
|
--html \
|
||||||
|
-r "\!7j-78_02dHROeLj4Ns8F12eo4IiZGv4zNsQ_1-WlyIU"
|
||||||
|
|
||||||
|
git -C "$FLAKE_DIR" reset --hard "pre-autoupdate-$TIME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
rm -f "$ERROR_FILE"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user