flake: autoupdate 2026-05-15T12-48-16Z

This commit is contained in:
2026-05-15 14:48:23 +02:00
parent 5bb9785a60
commit cc2e44afef
5 changed files with 71 additions and 3 deletions
Generated
+3 -3
View File
@@ -119,11 +119,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1778551015,
"narHash": "sha256-j299xXVjlKs5WtVkKSgEXZGvpTTw5X2iWwKs4KWv/Ag=",
"lastModified": 1778794387,
"narHash": "sha256-BL04pOS9453Awkeb9f90XBJXBSkWxN+vB7HIgnL0iMM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "0a0bf409f3593f415d0a554f33acc63dc7dccb43",
"rev": "8a1b0127302ea51e05bf4ea5a291743fac442406",
"type": "github"
},
"original": {
+6
View File
@@ -68,6 +68,12 @@
(pkgs.callPackage ../../modules/scripts/dontkillsteam.nix {}) # kill app (if it is steam put it in some background
(pkgs.callPackage ../../hostsModules/laptop/scripts/batterynotify.nix {})
(pkgs.callPackage ../../hostsModules/laptop/scripts/batterywarning.nix {})
# checks if matrix-commander-rs is installed and logged in
(pkgs.callPackage ../../hostsModules/laptop/scripts/checkMatrix.nix {})
# autoupdate the flake and send notification to system and to matrix
(pkgs.callPackage ../../hostsModules/laptop/scripts/autoUpdate.nix {})
(pkgs.callPackage ../../modules/scripts/weather.nix {})
(pkgs.callPackage ../../modules/scripts/wallpaper.nix {})
(pkgs.callPackage ../../modules/scripts/mountkdrive.nix {})
@@ -0,0 +1,40 @@
{
pkgs,
...
}:
pkgs.writeShellApplication {
name = "custom-autoupdate";
runtimeInputs = with pkgs; [
git
nixos-rebuild
matrix-commander-rs
libnotify
];
text = ''
set -e
FLAKE_DIR="/home/tomasr/nixos"
FLAKE="$FLAKE_DIR#laptop"
TIME=$(date -u +"%Y-%m-%dT%H-%M-%SZ")
git -C "$FLAKE_DIR" pull
git -C "$FLAKE_DIR" tag "pre-autoupdate-$TIME"
nix flake update --flake "$FLAKE_DIR"
if sudo nixos-rebuild switch --flake "$FLAKE"; then
git -C "$FLAKE_DIR" add flake.lock
git -C "$FLAKE_DIR" commit -m "flake: autoupdate $TIME"
git -C "$FLAKE_DIR" push
notify-send "Flake autoupdate" "Rebuild OK"
matrix-commander-rs -m "Flake rebuild OK"
else
notify-send -u critical "Flake autoupdate" "FAILED"
matrix-commander-rs -m "Flake rebuild FAILED"
git reset --hard "pre-autoupdate-$TIME"
fi
'';
}
@@ -0,0 +1,21 @@
{ pkgs }:
pkgs.writeShellApplication {
name = "custom-checkMatrix";
runtimeInputs = [
pkgs.matrix-commander-rs
pkgs.libnotify
];
text = ''
expected="@totorile1:unredacted.org"
current="$(matrix-commander-rs --whoami | tr -d '\n')"
if [ "$current" != "$expected" ]; then
notify-send "matrix-commander-rs" \
"You are not logged in as @totorile1:unredacted.org\nLog:\n$current"
fi
'';
}
+1
View File
@@ -218,6 +218,7 @@ in {
"custom-mountkdrive"
#"waybar"
"custom-gitnotify"
"custom-checkMatrix" # checks if matrix-commander-rs is connected which is important for other stuff
#"custom-obsidianbackup" # backups the obsidian notes to kdrive and to a timed hidden dir (~/.Notes.backup/)
#"QS-notifycache" # builds the cache that will be used for the notification history
"sleep 4 & caelestia-shell" #works better if it sleeps a bit before