anchor.diff:            <citerefentry><refentrytitle>systemd.time</refentrytitle>
             <manvolnum>7</manvolnum></citerefentry>
           '';
  +      };
  +
  +      rebootWindow = mkOption {
  +        description = ''
  +          Define a lower and upper time value (in HH:MM format) which
  +          constitute a time window during which reboots are allowed after an upgrade.
  +          This option only has an effect when <option>allowReboot</option> is enabled.
  +          The default value of <literal>null</literal> means that reboots are allowed at any time.
  +        '';
  +        default = null;
  +        example = { lower = "01:00"; upper = "05:00"; };
  +        type = with types; nullOr (submodule {
  +          options = {
  +            lower = mkOption {
  +              description = "Lower limit of the reboot window";
  +              type = types.strMatching "[[:digit:]]{2}:[[:digit:]]{2}";
  +              example = "01:00";
  +            };
  +
  +            upper = mkOption {
  +              description = "Upper limit of the reboot window";
  +              type = types.strMatching "[[:digit:]]{2}:[[:digit:]]{2}";
  +              example = "05:00";
  +            };
  +          };
  +        });
         };
   
       };
  
positive.code:       ];
  
        script = let
          nixos-rebuild =
            "${config.system.build.nixos-rebuild}/bin/nixos-rebuild";
        in if cfg.allowReboot then ''
          ${nixos-rebuild} boot ${toString cfg.flags}
          booted="$(readlink /run/booted-system/{initrd,kernel,kernel-modules})"
          built="$(readlink /nix/var/nix/profiles/system/{initrd,kernel,kernel-modules})"
          if [ "$booted" = "$built" ]; then
            ${nixos-rebuild} switch ${toString cfg.flags}
          else
            /run/current-system/sw/bin/shutdown -r +1
          fi
        '' else ''
          ${nixos-rebuild} switch ${toString cfg.flags}
        '';
  
        startAt = cfg.dates;
  
negative.code:     }];
  
      system.autoUpgrade.flags = (if cfg.flake == null then
          [ "--no-build-output" ] ++ optionals (cfg.channel != null) [
            "-I"
            "nixpkgs=${cfg.channel}/nixexprs.tar.xz"
          ]
        else
          [ "--flake ${cfg.flake}" ]);
  
  