add pre/post command
This commit is contained in:
parent
c07fe53f56
commit
cb0e49e5d6
1 changed files with 15 additions and 13 deletions
28
flake.nix
28
flake.nix
|
@ -19,8 +19,6 @@
|
||||||
arch = {
|
arch = {
|
||||||
"x86_64-linux" = "amd64";
|
"x86_64-linux" = "amd64";
|
||||||
}.${system};
|
}.${system};
|
||||||
|
|
||||||
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
packages = { };
|
packages = { };
|
||||||
|
@ -109,6 +107,14 @@
|
||||||
paths = lib.options.mkOption {
|
paths = lib.options.mkOption {
|
||||||
type = lib.types.listOf lib.types.str;
|
type = lib.types.listOf lib.types.str;
|
||||||
};
|
};
|
||||||
|
preCommand = lib.options.mkOption {
|
||||||
|
type = lib.types.lines;
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
|
postCommand = lib.options.mkOption {
|
||||||
|
type = lib.types.lines;
|
||||||
|
default = "";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
@ -160,20 +166,10 @@
|
||||||
AZURE_ACCOUNT_KEY=${cfg.azure.account_key}
|
AZURE_ACCOUNT_KEY=${cfg.azure.account_key}
|
||||||
'';
|
'';
|
||||||
}.${cfg.storage};
|
}.${cfg.storage};
|
||||||
# if cfg.storage == "b2"
|
|
||||||
# then
|
|
||||||
# else
|
|
||||||
# "";
|
|
||||||
repositoryConfig = {
|
repositoryConfig = {
|
||||||
"b2" = "b2:${bucket}:${directory}";
|
"b2" = "b2:${bucket}:${directory}";
|
||||||
"azure" = "azure:${bucket}:${directory}";
|
"azure" = "azure:${bucket}:${directory}";
|
||||||
}.${cfg.storage};
|
}.${cfg.storage};
|
||||||
|
|
||||||
# if cfg.storage == "b2"
|
|
||||||
# then
|
|
||||||
# "b2:${cfg.b2.bucket}:${config.networking.hostName}.${config.networking.domain}"
|
|
||||||
# else
|
|
||||||
# "";
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
text = ''
|
text = ''
|
||||||
|
@ -270,7 +266,13 @@
|
||||||
backup.excludes;
|
backup.excludes;
|
||||||
paths = lib.strings.concatStringsSep " " backup.paths;
|
paths = lib.strings.concatStringsSep " " backup.paths;
|
||||||
in
|
in
|
||||||
"${pkgs.restic}/bin/restic backup${one-file-system}${excludes} ${paths}"
|
''
|
||||||
|
${backup.preCommand}
|
||||||
|
|
||||||
|
${pkgs.restic}/bin/restic backup${one-file-system}${excludes} ${paths}
|
||||||
|
|
||||||
|
${backup.postCommand}
|
||||||
|
''
|
||||||
)
|
)
|
||||||
cfg.backups
|
cfg.backups
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue