diff options
-rw-r--r-- | modules/services/backup/default.nix | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/services/backup/default.nix b/modules/services/backup/default.nix index 2db1aa8..e935b64 100644 --- a/modules/services/backup/default.nix +++ b/modules/services/backup/default.nix @@ -1,5 +1,10 @@ { config, pkgs, lib, ... }: -let cfg = config.my.services.backup; +let + cfg = config.my.services.backup; + excludeArg = with builtins; + with pkgs; + "--exclude-file=" + + (writeText "excludes.txt" (concatStringsSep "\n" cfg.exclude)); in { options.my.services.backup = with lib; { enable = mkEnableOption "Enable backups for this host"; @@ -82,7 +87,8 @@ in { services.restic.backups.host = { # Take care of included and excluded files paths = cfg.paths; - extraBackupArgs = [ "--verbose=2" ]; + extraBackupArgs = [ "--verbose=2" ] + ++ lib.optional (builtins.length cfg.exclude != 0) excludeArg; # Take care of creating the repository if it doesn't exist initialize = true; inherit (cfg) passwordFile pruneOpts timerConfig repository user; |