borgbackup: add exclude option

This commit is contained in:
Jörg Thalheim
2024-07-21 19:06:09 +02:00
parent 49a07fc50f
commit 32876a5d5d
2 changed files with 12 additions and 1 deletions

View File

@@ -106,6 +106,16 @@ in
'';
};
options.clan.borgbackup.exclude = lib.mkOption {
type = lib.types.listOf lib.types.str;
example = [ "*.pyc" ];
default = [ ];
description = ''
Directories/Files to exclude from the backup.
Use * as a wildcard.
'';
};
imports = [
(lib.mkRemovedOptionModule [
"clan"
@@ -129,7 +139,7 @@ in
paths = lib.unique (
lib.flatten (map (state: state.folders) (lib.attrValues config.clan.core.state))
);
exclude = [ "*.pyc" ];
exclude = cfg.exclude;
repo = dest.repo;
environment.BORG_RSH = dest.rsh;
compression = "auto,zstd";

View File

@@ -39,6 +39,7 @@ class BorgbackupConfigDestination:
@dataclass
class BorgbackupConfig:
destinations: dict[str, BorgbackupConfigDestination] = field(default_factory = dict)
exclude: list[str] = field(default_factory = list)
@dataclass