I <3 unattended upgrades!
my current nixos configuration setup:
symlinked to:
g14 is my hostname, you need to change it to your hostname
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
};
outputs = {
self,
nixpkgs,
}: {
nixosConfigurations.g14 = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [./configuration.nix];
};
};
}
system.autoUpgrade = {
enable = true;
randomizedDelaySec = "30min"; # Adds a random delay to prevent simultaneous updates
dates = "daily"; # or "weekly", "monthly", etc.
flags = ["--impure" "--flake" "/etc/nixos"];
allowReboot = true; # Allow the system to reboot if necessary
# email = "your-email@example.com"; # Uncomment to receive email notifications
# emailOnFailure = true;
};
also, you need to change your rebuild command to:
$ nixos-rebuild switch --flake /etc/nixos
if you get the error "Failed to start nvidia-powerd service.", add this line to your configuration.nix
.
hardware.nvidia.dynamicBoost.enable = false;
To see the status of the timer run
$ systemctl status nixos-upgrade.timer
The upgrade log can be printed with this command
$ systemctl status nixos-upgrade.service
useful links:
Made with <3 in 2025