{ pkgs, lib, config, ... }: with lib; let cfg = config.clerie.nixfiles.system-auto-upgrade; in { options = { clerie.nixfiles.system-auto-upgrade = { enable = mkEnableOption "clerie nixfiles tools"; allowReboot = mkOption { type = types.bool; default = false; description = "Monitor NixOS"; }; }; }; config = mkIf cfg.enable { systemd.services.nixfiles-system-auto-upgrade = { serviceConfig = { Type = "oneshot"; ExecStart = pkgs.nixfiles-system-upgrade + "/bin/nixfiles-system-upgrade --no-confirm${optionalString cfg.allowReboot " --allow-reboot"}"; }; startAt = "*-*-* 06:47:00"; }; }; }