borgbackup: add numbers to jobs
This commit is contained in:
parent
5721531486
commit
a522300158
@ -61,16 +61,17 @@ in {
|
|||||||
};
|
};
|
||||||
|
|
||||||
services.borgbackup.jobs = builtins.listToAttrs (
|
services.borgbackup.jobs = builtins.listToAttrs (
|
||||||
map (attrs: let
|
lib.imap0 (
|
||||||
mountpoint = builtins.getAttr "mountpoint" attrs;
|
i: attrs: let
|
||||||
fs = builtins.getAttr mountpoint config.fileSystems;
|
mountpoint = builtins.getAttr "mountpoint" attrs;
|
||||||
in
|
fs = builtins.getAttr mountpoint config.fileSystems;
|
||||||
assert fs.fsType == "zfs";
|
in
|
||||||
assert lib.assertMsg
|
assert fs.fsType == "zfs";
|
||||||
config.mj.base.unitstatus.enable
|
assert lib.assertMsg
|
||||||
"config.mj.base.unitstatus.enable must be true"; {
|
config.mj.base.unitstatus.enable
|
||||||
name = lib.strings.sanitizeDerivationName mountpoint;
|
"config.mj.base.unitstatus.enable must be true";
|
||||||
value =
|
lib.nameValuePair
|
||||||
|
"${lib.strings.sanitizeDerivationName mountpoint}-${toString i}"
|
||||||
{
|
{
|
||||||
doInit = true;
|
doInit = true;
|
||||||
repo = attrs.repo;
|
repo = attrs.repo;
|
||||||
@ -97,14 +98,14 @@ in {
|
|||||||
}
|
}
|
||||||
// lib.optionalAttrs (sshKeyPath != null) {
|
// lib.optionalAttrs (sshKeyPath != null) {
|
||||||
environment.BORG_RSH = ''ssh -i "${config.mj.base.zfsborg.sshKeyPath}"'';
|
environment.BORG_RSH = ''ssh -i "${config.mj.base.zfsborg.sshKeyPath}"'';
|
||||||
};
|
}
|
||||||
})
|
)
|
||||||
dirs
|
dirs
|
||||||
);
|
);
|
||||||
|
|
||||||
mj.base.unitstatus.units = let
|
mj.base.unitstatus.units = let
|
||||||
sanitized = map lib.strings.sanitizeDerivationName (lib.catAttrs "mountpoint" dirs);
|
sanitized = map lib.strings.sanitizeDerivationName (lib.catAttrs "mountpoint" dirs);
|
||||||
in
|
in
|
||||||
map (n: "borgbackup-job-${n}") sanitized;
|
lib.imap0 (i: name: "borgbackup-job-${name}-${toString i}") sanitized;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user