AutoUpdate : Use system.autoUpgrade instead.
This commit is contained in:
parent
c8882354e2
commit
89b0c457b1
|
@ -1,24 +1,10 @@
|
||||||
{ pkgs, inputs, lib, config, ... }: {
|
{ pkgs, inputs, lib, config, ... }: {
|
||||||
systemd.services.autoupdate = {
|
system.autoUpgrade = {
|
||||||
description = "Automatically rebuild the system.";
|
enable = true;
|
||||||
# wantedBy = [ "multi-user.target" ];
|
allowReboot = false;
|
||||||
wants = [ "dotfiles.service" ];
|
dates = "daily";
|
||||||
after = [ "dotfiles.service" ];
|
flake = "/root/.config/linux/system";
|
||||||
serviceConfig.Type = "oneshot";
|
operation = "boot";
|
||||||
path = with pkgs; [
|
persistent = true;
|
||||||
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" ];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,12 @@
|
||||||
keep-derivations = true
|
keep-derivations = true
|
||||||
keep-outputs = true
|
keep-outputs = true
|
||||||
'';
|
'';
|
||||||
|
nix.gc = {
|
||||||
|
automatic = true;
|
||||||
|
dates = "daily";
|
||||||
|
options = "--delete-older-than 7d";
|
||||||
|
persistent = true;
|
||||||
|
};
|
||||||
nix.settings.auto-optimise-store = true;
|
nix.settings.auto-optimise-store = true;
|
||||||
nixpkgs.config.allowUnfree = true;
|
nixpkgs.config.allowUnfree = true;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue