diff --git a/flake.nix b/flake.nix index 33ea0f3..6016f0d 100644 --- a/flake.nix +++ b/flake.nix @@ -159,6 +159,7 @@ }; paths = lib.options.mkOption { type = lib.types.listOf lib.types.str; + default = [ ]; }; preCommand = lib.options.mkOption { type = lib.types.lines; @@ -267,32 +268,40 @@ ''; }.${cfg.storage}; - backupCommands = lib.strings.concatStringsSep "\n" ( - map - ( - backup: - let - oneFileSystem = - if backup.oneFileSystem - then - " --one-file-system" - else - ""; - excludes = lib.strings.concatMapStrings - ( - arg: '' --exclude="${arg}"'' - ) - backup.excludes; - paths = lib.strings.concatStringsSep " " backup.paths; - in - '' - ${backup.preCommand} - ${package}/bin/restic backup${oneFileSystem}${excludes} ${paths} - ${backup.postCommand} - '' - ) - cfg.backups - ); + backupCommands = lib.strings.concatStringsSep "\n" + ( + map + ( + backup: + let + oneFileSystem = + if backup.oneFileSystem + then + [ "--one-file-system" ] + else + [ ]; + excludes = map + ( + exclude: ''--exclude="${exclude}"'' + ) + backup.excludes; + paths = map + ( + path: ''"${path}"'' + ) + backup.paths; + arguments = lib.strings.concatStringsSep " " ( + oneFileSystem ++ excludes ++ paths + ); + in + '' + ${backup.preCommand} + ${package}/bin/restic backup ${arguments} + ${backup.postCommand} + '' + ) + cfg.backups + ); initCheck = { "b2" = '' export RCLONE_CONFIG=/dev/null