borgmatic: preparing upcoming borgmatic change
This commit changes the config format of repositories to the
soon-be-expected `{ "path": "repository-path", }`. The Home Manager
configuration allows a simple string (which will get translated), the
new format by directly using the path attribute, and the one with the
optional label attribute. More information about the background can be
found here https://torsion.org/borgmatic/docs/reference/configuration/
This commit is contained in:
parent
fc2a8842ea
commit
a421804890
2 changed files with 62 additions and 9 deletions
|
|
@ -13,6 +13,13 @@ let
|
|||
default = null;
|
||||
});
|
||||
|
||||
cleanRepositories = repos:
|
||||
map (repo:
|
||||
if builtins.isString repo then {
|
||||
path = repo;
|
||||
} else
|
||||
removeNullValues repo) repos;
|
||||
|
||||
mkRetentionOption = frequency:
|
||||
mkNullableOption {
|
||||
type = types.int;
|
||||
|
|
@ -27,6 +34,26 @@ let
|
|||
description = "Extra settings.";
|
||||
};
|
||||
|
||||
repositoryOption = types.submodule {
|
||||
options = {
|
||||
path = mkOption {
|
||||
type = types.str;
|
||||
example = "ssh://myuser@myrepo.myserver.com/./repo";
|
||||
description = "Path of the repository.";
|
||||
};
|
||||
|
||||
label = mkOption {
|
||||
type = types.nullOr types.str;
|
||||
default = null;
|
||||
example = "remote";
|
||||
description = ''
|
||||
Short text describing the repository. Can be used with the
|
||||
`--repository` flag to select a repository.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
consistencyCheckModule = types.submodule {
|
||||
options = {
|
||||
name = mkOption {
|
||||
|
|
@ -56,10 +83,23 @@ let
|
|||
};
|
||||
|
||||
repositories = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "Paths to repositories.";
|
||||
example =
|
||||
literalExpression ''["ssh://myuser@myrepo.myserver.com/./repo"]'';
|
||||
type = types.listOf (types.either types.str repositoryOption);
|
||||
apply = cleanRepositories;
|
||||
example = literalExpression ''
|
||||
[
|
||||
{
|
||||
"path" = "ssh://myuser@myrepo.myserver.com/./repo";
|
||||
"label" = "server";
|
||||
}
|
||||
{
|
||||
"path" = "/var/lib/backups/local.borg";
|
||||
"label" = "local";
|
||||
}
|
||||
]
|
||||
'';
|
||||
description = ''
|
||||
List of local or remote repositories with paths and optional labels.
|
||||
'';
|
||||
};
|
||||
|
||||
excludeHomeManagerSymlinks = mkOption {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue