make-snapshot-dirs

This commit is contained in:
Motiejus Jakštys 2023-01-26 13:08:41 -05:00
parent 9411df0162
commit 26ee5592ac
1 changed files with 13 additions and 3 deletions

View File

@ -335,9 +335,19 @@ in {
};
# TODO static snapshots
#systemd.services."make-snapshot-dirs" = {
# requiredBy =
#};
systemd.services."make-snapshot-dirs" = let
vals = builtins.attrValues backup_paths;
mountpoints = builtins.catAttrs "mountpoint" vals;
unique_mountpoints = lib.unique mountpoints;
in {
description = "prepare snapshot directories for backups";
wantedBy = ["multi-user.target"];
serviceConfig = {
Type = "oneshot";
ExecStart = builtins.map (d: "${pkgs.coreutils}/bin/mkdir -p ${d}/.snapshot-latest") unique_mountpoints;
RemainAfterExit = true;
};
};
# Do not change
system.stateVersion = "22.11";