autoupgrade
This commit is contained in:
parent
7a47e86acb
commit
f6a4f0994c
34
common/services/autoupgrade.nix
Normal file
34
common/services/autoupgrade.nix
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
{
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:{
|
||||||
|
# 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
|
||||||
|
|
||||||
|
${pkgs.git}/bin/git pull && \
|
||||||
|
${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;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
|
@ -33,6 +33,8 @@ in {
|
||||||
../../common/services/adguardhome.nix
|
../../common/services/adguardhome.nix
|
||||||
../../common/services/syncthing.nix
|
../../common/services/syncthing.nix
|
||||||
../../common/services/usbguard.nix
|
../../common/services/usbguard.nix
|
||||||
|
|
||||||
|
../../common/services/autoupgrade.nix
|
||||||
|
|
||||||
../../modules/nixos/vedirect-reader.nix
|
../../modules/nixos/vedirect-reader.nix
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue