From 26ee5592ac0d7c8dfcb70b73e40b4180264447e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Motiejus=20Jak=C5=A1tys?= Date: Thu, 26 Jan 2023 13:08:41 -0500 Subject: [PATCH] make-snapshot-dirs --- configuration.nix | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/configuration.nix b/configuration.nix index d82cc3c..af80aed 100644 --- a/configuration.nix +++ b/configuration.nix @@ -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";