This commit is contained in:
mjallen18
2025-06-03 10:16:34 -05:00
parent 90bf76ed37
commit eefd4b77af
6 changed files with 288 additions and 16 deletions

View File

@@ -1,4 +1,7 @@
{ pkgs, ... }:
let
nix-build-mail = pkgs.writeShellScript "echo -e \"Content-Type: text/plain\\r\\nSubject: NixOS cache rebuild failed\\r\\n\\r\\nThe nix-rebuild-cache service failed at $(date).\" | sendmail jalle008@proton.me";
in
{
# "https://cache.mjallen.dev"
# "cache.mjallen.dev-1:IzFmKCd8/gggI6lcCXsW65qQwiCLGFFN9t9s2iw7Lvc="
@@ -32,6 +35,7 @@
gnugrep
gnused
openssh
nix-build-mail
];
script = ''
#!/usr/bin/env bash
@@ -66,7 +70,7 @@
if nix build .\#nixosConfigurations.steamdeck.config.system.build.toplevel --no-link; then
echo "steamdeck built successfully at $(date)"
git add .
git commit -m "Dteamdeck Updates $(date)"
git commit -m "Steamdeck Updates $(date)"
else
echo "steamdeck failed to build at $(date)"
git reset --hard
@@ -117,18 +121,10 @@
echo "jallen-nas failed to build at $(date)"
git reset --hard
fi
# git push
'';
# Send an email on failure (optional)
startPost = ''
if [ $SERVICE_RESULT != "success" ]; then
${pkgs.mailutils}/bin/mail -s "NixOS cache rebuild failed" jalle008@proton.me <<EOF
The nix-rebuild-cache service failed at $(date).
Please check the logs with: journalctl -u nix-rebuild-cache
EOF
fi
'';
onSuccess = [ "git push" ];
# Send an email on failure
# onFailure = [ "nix-build-mail" ];
};
systemd.timers.nix-rebuild-cache = {