Merge pull request #266150 from robryk/resticnotimer

nixos/restic: allow timer to be disabled
This commit is contained in:
Lin Jian 2023-11-10 17:51:14 +08:00 committed by GitHub
commit 36f4c90526
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View File

@ -133,13 +133,15 @@ in
};
timerConfig = mkOption {
type = types.attrsOf unitOption;
type = types.nullOr (types.attrsOf unitOption);
default = {
OnCalendar = "daily";
Persistent = true;
};
description = lib.mdDoc ''
When to run the backup. See {manpage}`systemd.timer(5)` for details.
When to run the backup. See {manpage}`systemd.timer(5)` for
details. If null no timer is created and the backup will only
run when explicitly started.
'';
example = {
OnCalendar = "00:05";
@ -378,7 +380,7 @@ in
wantedBy = [ "timers.target" ];
timerConfig = backup.timerConfig;
})
config.services.restic.backups;
(filterAttrs (_: backup: backup.timerConfig != null) config.services.restic.backups);
# generate wrapper scripts, as described in the createWrapper option
environment.systemPackages = lib.mapAttrsToList (name: backup: let

View File

@ -55,6 +55,7 @@ import ./make-test-python.nix (
inherit passwordFile paths exclude pruneOpts backupPrepareCommand backupCleanupCommand;
repository = remoteRepository;
initialize = true;
timerConfig = null; # has no effect here, just checking that it doesn't break the service
};
remote-from-file-backup = {
inherit passwordFile exclude pruneOpts;