mirror of
https://github.com/nix-community/home-manager.git
synced 2026-10-02 19:49:18 +00:00
Add programs.borgmatic.backups.<name>.settings for native borgmatic YAML and generate each backup file from it. The location, storage, retention, and consistency options and the section extraConfig options become deprecated aliases into settings. Warnings name the affected backup. Legacy configurations without overlapping keys produce the same YAML, and Home Manager symlink exclusions still append to exclude_from. Drop the assertions that rejected backups setting both or neither of sourceDirectories and patterns, so native source patterns and database-only backups work.
46 lines
1.4 KiB
Nix
46 lines
1.4 KiB
Nix
{ lib, realPkgs, ... }:
|
|
{
|
|
programs.borgmatic = {
|
|
enable = true;
|
|
package = null;
|
|
backups = {
|
|
missingRepository.settings.source_directories = [ "/source" ];
|
|
missingLegacyRepository.location.sourceDirectories = [ "/source" ];
|
|
effective.settings = {
|
|
repositories = [ { path = "/repo"; } ];
|
|
postgresql_databases = [ { name = "native"; } ];
|
|
};
|
|
};
|
|
};
|
|
test.asserts.assertions.expected = [
|
|
''
|
|
Borgmatic backup configuration "missingLegacyRepository" must specify 'settings.repositories' (or the deprecated 'location.repositories').
|
|
''
|
|
''
|
|
Borgmatic backup configuration "missingRepository" must specify 'settings.repositories' (or the deprecated 'location.repositories').
|
|
''
|
|
];
|
|
|
|
test.asserts.warnings.expected = (import ./warnings.nix { inherit lib; }) {
|
|
file = ./settings-assertions.nix;
|
|
backup = "missingLegacyRepository";
|
|
entries = [
|
|
{
|
|
from = "location.sourceDirectories";
|
|
to = "settings.source_directories";
|
|
}
|
|
];
|
|
};
|
|
|
|
nmt.script = ''
|
|
config_file=$TESTED/home-files/.config/borgmatic.d/effective.yaml
|
|
assertFileExists "$config_file"
|
|
${realPkgs.jq}/bin/jq --exit-status '
|
|
(has("source_directories") | not) and
|
|
(has("patterns") | not) and
|
|
.postgresql_databases == [{"name": "native"}] and
|
|
.repositories == [{"path": "/repo"}]
|
|
' "$config_file"
|
|
'';
|
|
}
|