about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorRobert Obryk <robryk@gmail.com>2023-08-16 11:42:29 +0200
committerRobert Obryk <robryk@gmail.com>2023-11-07 22:37:37 +0100
commit20b202b3c809a3b599742a41fdf5a34a261910fc (patch)
tree1b2d6d12c028491c7539be80c2ddadfb9d350f7e /nixos/modules
parentaca44fe2192391eae0eb29ff3b88bd9ee67dadc8 (diff)
downloadnixlib-20b202b3c809a3b599742a41fdf5a34a261910fc.tar
nixlib-20b202b3c809a3b599742a41fdf5a34a261910fc.tar.gz
nixlib-20b202b3c809a3b599742a41fdf5a34a261910fc.tar.bz2
nixlib-20b202b3c809a3b599742a41fdf5a34a261910fc.tar.lz
nixlib-20b202b3c809a3b599742a41fdf5a34a261910fc.tar.xz
nixlib-20b202b3c809a3b599742a41fdf5a34a261910fc.tar.zst
nixlib-20b202b3c809a3b599742a41fdf5a34a261910fc.zip
nixos/restic: allow timer to be disabled
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/services/backup/restic.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/nixos/modules/services/backup/restic.nix b/nixos/modules/services/backup/restic.nix
index fcdd3082f5a6..87595f39796d 100644
--- a/nixos/modules/services/backup/restic.nix
+++ b/nixos/modules/services/backup/restic.nix
@@ -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