From e412025fffdcd6219ddd21c65d9a1b90005ce508 Mon Sep 17 00:00:00 2001 From: Matt Bryant Date: Mon, 12 Dec 2022 21:50:23 -0800 Subject: [PATCH] borgmatic: allow lists in extraConfig In particular, we should be able to specify `exclude_backups` in our configuration. Fixes #3489 --- modules/programs/borgmatic.nix | 2 +- tests/modules/programs/borgmatic/basic-configuration.nix | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/programs/borgmatic.nix b/modules/programs/borgmatic.nix index 054ee232b..d69803884 100644 --- a/modules/programs/borgmatic.nix +++ b/modules/programs/borgmatic.nix @@ -20,7 +20,7 @@ let }; extraConfigOption = mkOption { - type = with types; attrsOf (oneOf [ str bool path int ]); + type = with types; attrsOf (oneOf [ str bool path int (listOf str) ]); default = { }; description = "Extra settings."; }; diff --git a/tests/modules/programs/borgmatic/basic-configuration.nix b/tests/modules/programs/borgmatic/basic-configuration.nix index 7a7b63d28..b9988d470 100644 --- a/tests/modules/programs/borgmatic/basic-configuration.nix +++ b/tests/modules/programs/borgmatic/basic-configuration.nix @@ -12,7 +12,10 @@ in { location = { sourceDirectories = [ "/my-stuff-to-backup" ]; repositories = [ "/mnt/disk1" "/mnt/disk2" ]; - extraConfig = { one_file_system = true; }; + extraConfig = { + one_file_system = true; + exclude_patterns = [ "*.swp" ]; + }; }; storage = { @@ -64,6 +67,9 @@ in { expectations[location.one_file_system]="${ boolToString backups.main.location.extraConfig.one_file_system }" + expectations[location.exclude_patterns[0]]="${ + builtins.elemAt backups.main.location.extraConfig.exclude_patterns 0 + }" expectations[storage.encryption_passcommand]="${backups.main.storage.encryptionPasscommand}" expectations[storage.checkpoint_interval]="${