AutoUpdate : Use system.autoUpgrade instead.

This commit is contained in:
Dmitry Voronin 2024-03-04 00:04:04 +03:00
parent c8882354e2
commit 89b0c457b1
2 changed files with 14 additions and 22 deletions

View file

@ -1,24 +1,10 @@
{ pkgs, inputs, lib, config, ... }: {
systemd.services.autoupdate = {
description = "Automatically rebuild the system.";
# wantedBy = [ "multi-user.target" ];
wants = [ "dotfiles.service" ];
after = [ "dotfiles.service" ];
serviceConfig.Type = "oneshot";
path = with pkgs; [
git
];
script = ''
${config.system.build.nixos-rebuild}/bin/nixos-rebuild boot --flake "/root/.config/linux/system#$HOSTNAME"
${config.nix.package.out}/bin/nix-collect-garbage --delete-older-than 7d
'';
};
systemd.timers.autoupdate = {
timerConfig = {
OnCalendar = "daily";
Persistent = true;
Unit = "autoupdate.service";
};
wantedBy = [ "timers.target" ];
system.autoUpgrade = {
enable = true;
allowReboot = false;
dates = "daily";
flake = "/root/.config/linux/system";
operation = "boot";
persistent = true;
};
}

View file

@ -5,6 +5,12 @@
keep-derivations = true
keep-outputs = true
'';
nix.gc = {
automatic = true;
dates = "daily";
options = "--delete-older-than 7d";
persistent = true;
};
nix.settings.auto-optimise-store = true;
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowUnfree = true;
}