This commit is contained in:
Tasia Iso 2024-05-24 13:43:30 +02:00
parent 2a57f911f6
commit f927228b42
Signed by: tasiaiso
SSH key fingerprint: SHA256:KiRjUay5C9i6objsEOIycygBHn54pDBB3Lj7fyJ0Elw

View file

@ -1,32 +1,44 @@
{pkgs, ...}: {
systemd.timers."nix-auto-upgrade" = {
wantedBy = ["timers.target"];
timerConfig = {
OnCalendar = "weekly";
Persistent = true;
Unit = "nix-auto-upgrade";
};
};
# systemd.timers."nix-auto-upgrade" = {
# wantedBy = ["timers.target"];
# timerConfig = {
# OnCalendar = "weekly";
# Persistent = true;
# Unit = "nix-auto-upgrade";
# };
# };
systemd.services."nix-auto-upgrade" = {
script = ''
set -eu
alias git=${pkgs.git}/bin/git
# systemd.services."nix-auto-upgrade" = {
# script = ''
# set -eu
# # alias git=${pkgs.git}/bin/git
${pkgs.git}/bin/git pull
${pkgs.nixos-rebuild}/bin/nixos-rebuild switch --flake .#$(cat /etc/hostname)
# ${pkgs.git}/bin/git pull -v
# # ${pkgs.nixos-rebuild}/bin/nixos-rebuild switch --flake .#$(cat /etc/hostname)
${pkgs.curl}/bin/curl \
-H "Title: NixOS upgrade done" \
-H "Priority: low" \
-H "Tags: low" \
-d "$(cat /etc/hostname ): upgrade script done" \
ntfy.sh/tasiaiso_upgrades &> /dev/null # Please don't make me learn how to manage secrets
'';
serviceConfig = {
Type = "oneshot";
User = "root";
WorkingDirectory = /etc/nixos/nixos-config;
};
# # ${pkgs.curl}/bin/curl \
# # -H "Title: NixOS upgrade done" \
# # -H "Priority: low" \
# # -H "Tags: low" \
# # -d "$(cat /etc/hostname ): upgrade script done" \
# # ntfy.sh/tasiaiso_upgrades &> /dev/null # Please don't make me learn how to manage secrets
# '';
# serviceConfig = {
# Type = "oneshot";
# User = "root";
# WorkingDirectory = /etc/nixos/nixos-config;
# };
# };
system.autoUpgrade = {
enable = true;
flake = "git+https://gitea.com/tasiaiso/nixos-config";
flags = [
# "--update-input"
# "nixpkgs"
"-L" # print build logs
];
dates = "weekly";
# randomizedDelaySec = "45min";
};
}