nix/modules/nixos/auto-upgrade.nix

22 lines
524 B
Nix

{ config, lib, ... }:
{
options.nixos.autoUpgrade = {
enable = lib.mkEnableOption "automatic NixOS upgrades";
flakePath = lib.mkOption {
type = lib.types.str;
description = "Path to the flake for auto-upgrade";
};
};
config = lib.mkIf config.nixos.autoUpgrade.enable {
system.autoUpgrade = {
enable = true;
flake = config.nixos.autoUpgrade.flakePath;
flags = [ "-L" ];
dates = "02:00";
randomizedDelaySec = "45min";
operation = "switch";
};
};
}