anchor.diff:          let
             extraOptions = concatMapStrings (arg: " -o ${arg}") backup.extraOptions;
             resticCmd = "${pkgs.restic}/bin/restic${extraOptions}";
  +          filesFromTmpFile = "/run/restic-backups-${name}/includes";
  +          preStartInit = if backup.initialize
  +                         then "${resticCmd} snapshots || ${resticCmd} init"
  +                         else "";
  +          dynamicFilesFromScript = pkgs.writeScript "dynamicFilesFromScript" backup.dynamicFilesFrom;
  +          preStartFiles = if backup.dynamicFilesFrom != null
  +                          then "${dynamicFilesFromScript} > ${filesFromTmpFile}"
  +                          else "";
  +          preStartAttr = if (backup.initialize || backup.dynamicFilesFrom != null)
  +                         then {
  +                           preStart = ''
  +                             ${preStartInit}
  +                             ${preStartFiles}
  +                           '';
  +                         }
  +                         else {};
  +          backupPaths = if (backup.dynamicFilesFrom == null)
  +                        then concatStringsSep " " backup.paths
  +                        else "--files-from ${filesFromTmpFile}";
             pruneCmd = if (builtins.length backup.pruneOpts > 0)
                        then [ ( resticCmd + " forget --prune " +
                                 (concatStringsSep " " backup.pruneOpts) )
  
positive.code:           restartIfChanged = false;
            serviceConfig = {
              Type = "oneshot";
              ExecStart = [ "${resticCmd} backup ${concatStringsSep " " backup.extraBackupArgs} ${concatStringsSep " " backup.paths}" ] ++ pruneCmd;
              User = backup.user;
            } // optionalAttrs (backup.s3CredentialsFile != null) {
              EnvironmentFile = backup.s3CredentialsFile;
            };
          } // optionalAttrs backup.initialize {
            preStart = ''
              ${resticCmd} snapshots || ${resticCmd} init
            '';
          })
        ) config.services.restic.backups;
  
negative.code:             "--keep-monthly 12"
              "--keep-yearly 75"
            ];
          };
  
          dynamicFilesFrom = mkOption {
            type = with types; nullOr str;
            default = null;
            description = ''
              A script that produces a list of files to back up.  The
              results of this command are given to the '--files-from'
              option.
            '';
            example = "find /home/matt/git -type d -name .git";
          };
        };
      }));
  