mirror of
https://github.com/tomasriveral/nixos.git
synced 2026-08-12 10:30:44 +02:00
snapshot pre-autoupdate-2026-07-26T12-32-47Z
This commit is contained in:
@@ -6,8 +6,11 @@
|
|||||||
age.identityPaths = [
|
age.identityPaths = [
|
||||||
"/home/tomasr/.ssh/id_ed25519"
|
"/home/tomasr/.ssh/id_ed25519"
|
||||||
];
|
];
|
||||||
age.secrets.my-secret = {
|
age.secrets.ntfy = {
|
||||||
file = ../../secrets/my-secret.age;
|
file = ../../secrets/ntfy.age;
|
||||||
|
owner = "tomasr";
|
||||||
|
group = "users";
|
||||||
|
mode = "0400";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
{self, ...}: {
|
{self, ...}: {
|
||||||
flake.nixosModules.autoUpdate-laptop = {pkgs, ...}: {
|
flake.nixosModules.autoUpdate-laptop = {pkgs, config, ...}: {
|
||||||
|
age.secrets.ntfy = {
|
||||||
|
file = ../../secrets/ntfy.age;
|
||||||
|
};
|
||||||
# Ensure your script is available system-wide
|
# Ensure your script is available system-wide
|
||||||
environment.systemPackages = [
|
environment.systemPackages = [
|
||||||
self.packages.${pkgs.system}.custom-autoupdate-laptop
|
self.packages.${pkgs.system}.custom-autoupdate-laptop
|
||||||
@@ -12,6 +15,9 @@
|
|||||||
description = "NixOS flake auto update";
|
description = "NixOS flake auto update";
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
|
Environment = [
|
||||||
|
"NTFY_SECRET=${config.age.secrets.ntfy.path}"
|
||||||
|
];
|
||||||
Type = "oneshot";
|
Type = "oneshot";
|
||||||
|
|
||||||
ExecStart = "/run/current-system/sw/bin/custom-autoupdate";
|
ExecStart = "/run/current-system/sw/bin/custom-autoupdate";
|
||||||
@@ -98,11 +104,13 @@
|
|||||||
runtimeInputs = with pkgs; [
|
runtimeInputs = with pkgs; [
|
||||||
git
|
git
|
||||||
nixos-rebuild
|
nixos-rebuild
|
||||||
matrix-commander-rs
|
curl
|
||||||
libnotify
|
libnotify
|
||||||
];
|
];
|
||||||
|
|
||||||
text = ''
|
text = ''
|
||||||
|
# shellcheck disable=SC1090
|
||||||
|
source "$NTFY_SECRET"
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
FLAKE_DIR="/home/tomasr/nixos"
|
FLAKE_DIR="/home/tomasr/nixos"
|
||||||
@@ -128,9 +136,11 @@
|
|||||||
|
|
||||||
notify-send "Flake autoupdate" "Rebuild OK"
|
notify-send "Flake autoupdate" "Rebuild OK"
|
||||||
|
|
||||||
matrix-commander-rs --verbose -m "Flake rebuild succesfull.<br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \
|
curl \
|
||||||
--html \
|
-u ":$NTFY_TOKEN" \
|
||||||
-r "\!BXRRokBmEdNOyYdfOF:matrix.org"
|
-d "Flake rebuild successful" \
|
||||||
|
-H "Title: Flake autoupdate" \
|
||||||
|
"$NTFY_SERVER/Alerts"
|
||||||
else
|
else
|
||||||
notify-send "Flake autoupdate" "No changes"
|
notify-send "Flake autoupdate" "No changes"
|
||||||
git -C "$FLAKE_DIR" push
|
git -C "$FLAKE_DIR" push
|
||||||
@@ -141,9 +151,12 @@
|
|||||||
|
|
||||||
notify-send -u critical "Flake autoupdate" "FAILED"
|
notify-send -u critical "Flake autoupdate" "FAILED"
|
||||||
|
|
||||||
matrix-commander-rs --verbose -m "Flake rebuild failed.<br>Error: <pre>$ERROR_MSG</pre><br><a href=\"https://matrix.to/#/@notificationbot_0000:matrix.org\">@notificationbot_0000</a>" \
|
curl \
|
||||||
--html \
|
-u ":$NTFY_TOKEN" \
|
||||||
-r "\!BXRRokBmEdNOyYdfOF:matrix.org"
|
-d "Flake rebuild failed. Error: $ERROR_MSG" \
|
||||||
|
-H "Title: Flake autoupdate FAILED" \
|
||||||
|
-H "Priority: urgent" \
|
||||||
|
"$NTFY_SERVER/Alerts"
|
||||||
|
|
||||||
git -C "$FLAKE_DIR" reset --hard "pre-autoupdate-$TIME"
|
git -C "$FLAKE_DIR" reset --hard "pre-autoupdate-$TIME"
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
age-encryption.org/v1
|
|
||||||
-> ssh-ed25519 pcPqbA GG04OY1WKDS1Rc1aRhODZShiWZfdw0cDHN+s/8XqDzA
|
|
||||||
9/SS7ZOQDh1H+27JT7fTi3GV5C19CjIPR9i4jjKjM9E
|
|
||||||
--- Irxkq9bamw6q0qsEZHlym6pC0gDxpty+bbg14OAgkxQ
|
|
||||||
ëĶ‘²ó<…¥É¨¬!†K!þ‘L;Ú~´]¶Fñ»Ak‰õwÐy62ϽK<B‚{P=,@q-WÑUUh|c]ZÝœsR‰²›¨3%[â´¾eC WË2M`Ú#ìõ3ìSÇ␍pû˜³tZEtbK4{×Ñ¡bÄ3QuhzȘ(òË ¬%¹ZÒ»@ÇI[£_².˜ð
|
|
||||||
Binary file not shown.
+1
-1
@@ -2,7 +2,7 @@ let
|
|||||||
myKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC6WNm4YAQO85j0aNQkKSH7QnmhgzKA4hA2ggi6cDyKk tomasr@nixos";
|
myKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC6WNm4YAQO85j0aNQkKSH7QnmhgzKA4hA2ggi6cDyKk tomasr@nixos";
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
"my-secret.age".publicKeys = [
|
"ntfy.age".publicKeys = [
|
||||||
myKey
|
myKey
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user