fix mismatched types issue
This commit is contained in:
parent
751f878765
commit
4932730857
1 changed files with 40 additions and 41 deletions
|
|
@ -124,49 +124,48 @@ in {
|
||||||
extraConfig = extraCfg;
|
extraConfig = extraCfg;
|
||||||
};
|
};
|
||||||
}) {} (builtins.attrNames cfg);
|
}) {} (builtins.attrNames cfg);
|
||||||
|
};
|
||||||
|
|
||||||
services.borgbackup.jobs =
|
services.borgbackup.jobs =
|
||||||
builtins.foldl'
|
builtins.foldl'
|
||||||
(acc: key: let
|
(acc: key: let
|
||||||
site = cfg.${key};
|
site = cfg.${key};
|
||||||
dump = site.backup.database;
|
dump = site.backup.database;
|
||||||
paths = builtins.concatLists [
|
paths = builtins.concatLists [
|
||||||
site.backup.paths
|
site.backup.paths
|
||||||
(if dump != null then [ "/var/backup/${key}.sql" ] else [])
|
(if dump != null then [ "/var/backup/${key}.sql" ] else [])
|
||||||
];
|
];
|
||||||
preHook = lib.mkIf (dump != null) ''
|
preHook = lib.mkIf (dump != null) ''
|
||||||
mkdir -p /var/backup
|
mkdir -p /var/backup
|
||||||
${pkgs.sudo}/bin/sudo -u postgres pg_dump ${dump} > /var/backup/postgres/${key}.sql
|
${pkgs.sudo}/bin/sudo -u postgres pg_dump ${dump} > /var/backup/postgres/${key}.sql
|
||||||
'';
|
'';
|
||||||
postHook = lib.mkIf (dump != null) ''
|
postHook = lib.mkIf (dump != null) ''
|
||||||
rm -f /var/backup/postgres/${key}.sql
|
rm -f /var/backup/postgres/${key}.sql
|
||||||
'';
|
'';
|
||||||
in
|
in
|
||||||
acc
|
acc
|
||||||
// lib.mkIf site.backup.enable {
|
// lib.mkIf site.backup.enable {
|
||||||
"${key}" = {
|
"${key}" = {
|
||||||
repo = backup_cfg.borgRepository + "/./${key}";
|
repo = backup_cfg.borgRepository + "/./${key}";
|
||||||
environment = {
|
environment = {
|
||||||
BORG_RSH = "ssh -i ${backup_cfg.borgSSHKey} -o 'StrictHostKeyChecking=no'";
|
BORG_RSH = "ssh -i ${backup_cfg.borgSSHKey} -o 'StrictHostKeyChecking=no'";
|
||||||
};
|
|
||||||
inherit paths;
|
|
||||||
encryption = {
|
|
||||||
mode = "keyfile";
|
|
||||||
passCommand = backup_cfg.borgPassCommand;
|
|
||||||
};
|
|
||||||
compression = "auto,lzma";
|
|
||||||
startAt = "daily";
|
|
||||||
prune.keep = {
|
|
||||||
daily = 7;
|
|
||||||
weekly = 4;
|
|
||||||
monthly = -1;
|
|
||||||
};
|
|
||||||
inherit preHook;
|
|
||||||
inherit postHook;
|
|
||||||
};
|
};
|
||||||
})
|
inherit paths;
|
||||||
{}
|
encryption = {
|
||||||
(builtins.attrNames cfg);
|
mode = "keyfile";
|
||||||
|
passCommand = backup_cfg.borgPassCommand;
|
||||||
|
};
|
||||||
|
compression = "auto,lzma";
|
||||||
|
startAt = "daily";
|
||||||
|
prune.keep = {
|
||||||
|
daily = 7;
|
||||||
|
weekly = 4;
|
||||||
|
monthly = -1;
|
||||||
|
};
|
||||||
|
inherit preHook;
|
||||||
|
inherit postHook;
|
||||||
|
};
|
||||||
|
}) {} (builtins.attrNames cfg);
|
||||||
|
|
||||||
systemd.tmpfiles.settings = {
|
systemd.tmpfiles.settings = {
|
||||||
"99-borgdatabasebackups"."/var/backup/postgres".d = {
|
"99-borgdatabasebackups"."/var/backup/postgres".d = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue