Loading nixos/modules/services/backup/restic.nix +1 −1 Original line number Diff line number Diff line Loading @@ -374,7 +374,7 @@ in ${resticCmd} cat config > /dev/null || ${resticCmd} init ''} ${optionalString (backup.paths != null && backup.paths != []) '' cat ${pkgs.writeText "staticPaths" (concatStringsSep "\n" backup.paths)} >> ${filesFromTmpFile} cat ${pkgs.writeText "staticPaths" (concatLines backup.paths)} >> ${filesFromTmpFile} ''} ${optionalString (backup.dynamicFilesFrom != null) '' ${pkgs.writeScript "dynamicFilesFromScript" backup.dynamicFilesFrom} >> ${filesFromTmpFile} Loading nixos/tests/restic.nix +11 −4 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import ./make-test-python.nix ( echo some_other_file > $out/some_other_file mkdir $out/a_dir echo a_file > $out/a_dir/a_file echo a_file_2 > $out/a_dir/a_file_2 ''; }; Loading Loading @@ -62,7 +63,10 @@ import ./make-test-python.nix ( inherit passwordFile exclude pruneOpts; initialize = true; repositoryFile = pkgs.writeText "repositoryFile" remoteFromFileRepository; paths = [ "/opt/a_dir" ]; paths = [ "/opt/a_dir/a_file" "/opt/a_dir/a_file_2" ]; dynamicFilesFrom = '' find /opt -mindepth 1 -maxdepth 1 ! -name a_dir # all files in /opt except for a_dir ''; Loading Loading @@ -144,15 +148,18 @@ import ./make-test-python.nix ( # test that remote-from-file-backup produces a snapshot "systemctl start restic-backups-remote-from-file-backup.service", 'restic-remote-from-file-backup snapshots --json | ${pkgs.jq}/bin/jq "length | . == 1"', "mkdir /tmp/restore-2", "restic-remote-from-file-backup restore latest -t /tmp/restore-2", "diff -ru ${testDir} /tmp/restore-2/opt", # test that remote-noinit-backup produces a snapshot "systemctl start restic-backups-remote-noinit-backup.service", 'restic-remote-noinit-backup snapshots --json | ${pkgs.jq}/bin/jq "length | . == 1"', # test that restoring that snapshot produces the same directory "mkdir /tmp/restore-2", "${pkgs.restic}/bin/restic -r ${remoteRepository} -p ${passwordFile} restore latest -t /tmp/restore-2", "diff -ru ${testDir} /tmp/restore-2/opt", "mkdir /tmp/restore-3", "${pkgs.restic}/bin/restic -r ${remoteRepository} -p ${passwordFile} restore latest -t /tmp/restore-3", "diff -ru ${testDir} /tmp/restore-3/opt", # test that rclonebackup produces a snapshot "systemctl start restic-backups-rclonebackup.service", Loading Loading
nixos/modules/services/backup/restic.nix +1 −1 Original line number Diff line number Diff line Loading @@ -374,7 +374,7 @@ in ${resticCmd} cat config > /dev/null || ${resticCmd} init ''} ${optionalString (backup.paths != null && backup.paths != []) '' cat ${pkgs.writeText "staticPaths" (concatStringsSep "\n" backup.paths)} >> ${filesFromTmpFile} cat ${pkgs.writeText "staticPaths" (concatLines backup.paths)} >> ${filesFromTmpFile} ''} ${optionalString (backup.dynamicFilesFrom != null) '' ${pkgs.writeScript "dynamicFilesFromScript" backup.dynamicFilesFrom} >> ${filesFromTmpFile} Loading
nixos/tests/restic.nix +11 −4 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ import ./make-test-python.nix ( echo some_other_file > $out/some_other_file mkdir $out/a_dir echo a_file > $out/a_dir/a_file echo a_file_2 > $out/a_dir/a_file_2 ''; }; Loading Loading @@ -62,7 +63,10 @@ import ./make-test-python.nix ( inherit passwordFile exclude pruneOpts; initialize = true; repositoryFile = pkgs.writeText "repositoryFile" remoteFromFileRepository; paths = [ "/opt/a_dir" ]; paths = [ "/opt/a_dir/a_file" "/opt/a_dir/a_file_2" ]; dynamicFilesFrom = '' find /opt -mindepth 1 -maxdepth 1 ! -name a_dir # all files in /opt except for a_dir ''; Loading Loading @@ -144,15 +148,18 @@ import ./make-test-python.nix ( # test that remote-from-file-backup produces a snapshot "systemctl start restic-backups-remote-from-file-backup.service", 'restic-remote-from-file-backup snapshots --json | ${pkgs.jq}/bin/jq "length | . == 1"', "mkdir /tmp/restore-2", "restic-remote-from-file-backup restore latest -t /tmp/restore-2", "diff -ru ${testDir} /tmp/restore-2/opt", # test that remote-noinit-backup produces a snapshot "systemctl start restic-backups-remote-noinit-backup.service", 'restic-remote-noinit-backup snapshots --json | ${pkgs.jq}/bin/jq "length | . == 1"', # test that restoring that snapshot produces the same directory "mkdir /tmp/restore-2", "${pkgs.restic}/bin/restic -r ${remoteRepository} -p ${passwordFile} restore latest -t /tmp/restore-2", "diff -ru ${testDir} /tmp/restore-2/opt", "mkdir /tmp/restore-3", "${pkgs.restic}/bin/restic -r ${remoteRepository} -p ${passwordFile} restore latest -t /tmp/restore-3", "diff -ru ${testDir} /tmp/restore-3/opt", # test that rclonebackup produces a snapshot "systemctl start restic-backups-rclonebackup.service", Loading