@@ -93,10 +93,12 @@ in
9393 };
9494
9595 paths = mkOption {
96− type = types.listOf types.str;
97− default = [];
96+ type = types.nullOr (types.listOf types.str);
97+ default = null;
9898 description = ''
99− Which paths to backup.
99+ Which paths to backup. If null or an empty array, no
100+ backup command will be run. This can be used to create a
101+ prune-only job.
100102 '';
101103 example = [
102104 "/var/lib/postgresql"
@@ -217,7 +219,7 @@ in
217219 resticCmd = "${pkgs.restic}/bin/restic${extraOptions}";
218220 filesFromTmpFile = "/run/restic-backups-${name}/includes";
219221 backupPaths = if (backup.dynamicFilesFrom == null)
220− then concatStringsSep " " backup.paths
222+ then if (backup.paths != null) then concatStringsSep " " backup.paths else ""
221223 else "--files-from ${filesFromTmpFile}";
222224 pruneCmd = optionals (builtins.length backup.pruneOpts > 0) [
223225 ( resticCmd + " forget --prune " + (concatStringsSep " " backup.pruneOpts) )
@@ -243,7 +245,8 @@ in
243245 restartIfChanged = false;
244246 serviceConfig = {
245247 Type = "oneshot";
246− ExecStart = [ "${resticCmd} backup --cache-dir=%C/restic-backups-${name} ${concatStringsSep " " backup.extraBackupArgs} ${backupPaths}" ] ++ pruneCmd;
248+ ExecStart = (optionals (backupPaths != "") [ "${resticCmd} backup --cache-dir=%C/restic-backups-${name} ${concatStringsSep " " backup.extraBackupArgs} ${backupPaths}" ])
249+ ++ pruneCmd;
247250 User = backup.user;
248251 RuntimeDirectory = "restic-backups-${name}";
249252 CacheDirectory = "restic-backups-${name}";