summary refs log tree commit diff
path: root/nixos/tests/restic.nix
diff options
context:
space:
mode:
authorRobert Obryk <robryk@gmail.com>2022-12-04 00:00:58 +0100
committerRobert Obryk <robryk@gmail.com>2023-01-11 00:06:13 +0100
commit9dbdb059245ccdb8e7e8161c6a37301a5397ef6d (patch)
treea9a88d025b708f1f3058778e77cba133cce4cc20 /nixos/tests/restic.nix
parent2a46ef4fff95d3ac23b65a97a1c9be54cca3ddb4 (diff)
downloadnixpkgs-9dbdb059245ccdb8e7e8161c6a37301a5397ef6d.tar
nixpkgs-9dbdb059245ccdb8e7e8161c6a37301a5397ef6d.tar.gz
nixpkgs-9dbdb059245ccdb8e7e8161c6a37301a5397ef6d.tar.bz2
nixpkgs-9dbdb059245ccdb8e7e8161c6a37301a5397ef6d.tar.lz
nixpkgs-9dbdb059245ccdb8e7e8161c6a37301a5397ef6d.tar.xz
nixpkgs-9dbdb059245ccdb8e7e8161c6a37301a5397ef6d.tar.zst
nixpkgs-9dbdb059245ccdb8e7e8161c6a37301a5397ef6d.zip
nixos/restic: add exclude parameter
This provides an easy way to specify exclude patterns in config. It was
already possible via extraBackupOptions; this change creates a simpler,
similar to other backup services, way to specify them.
Diffstat (limited to 'nixos/tests/restic.nix')
-rw-r--r--nixos/tests/restic.nix8
1 files changed, 5 insertions, 3 deletions
diff --git a/nixos/tests/restic.nix b/nixos/tests/restic.nix
index 0a4fc4c6455..42af0783863 100644
--- a/nixos/tests/restic.nix
+++ b/nixos/tests/restic.nix
@@ -27,6 +27,7 @@ import ./make-test-python.nix (
 
     passwordFile = "${pkgs.writeText "password" "correcthorsebatterystaple"}";
     paths = [ "/opt" ];
+    exclude = [ "/opt/excluded_file_*" ];
     pruneOpts = [
       "--keep-daily 2"
       "--keep-weekly 1"
@@ -47,17 +48,17 @@ import ./make-test-python.nix (
         {
           services.restic.backups = {
             remotebackup = {
-              inherit passwordFile paths pruneOpts backupPrepareCommand backupCleanupCommand;
+              inherit passwordFile paths exclude pruneOpts backupPrepareCommand backupCleanupCommand;
               repository = remoteRepository;
               initialize = true;
             };
             remote-from-file-backup = {
-              inherit passwordFile paths pruneOpts;
+              inherit passwordFile paths exclude pruneOpts;
               initialize = true;
               repositoryFile = pkgs.writeText "repositoryFile" remoteFromFileRepository;
             };
             rclonebackup = {
-              inherit passwordFile paths pruneOpts;
+              inherit passwordFile paths exclude pruneOpts;
               initialize = true;
               repository = rcloneRepository;
               rcloneConfig = {
@@ -104,6 +105,7 @@ import ./make-test-python.nix (
       server.succeed(
           # set up
           "cp -rT ${testDir} /opt",
+          "touch /opt/excluded_file_1 /opt/excluded_file_2",
           "mkdir -p /tmp/restic-rclone-backup",
 
           # test that remotebackup runs custom commands and produces a snapshot