summary refs log tree commit diff stats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--sys/services/restic/default.nix11
1 files changed, 9 insertions, 2 deletions
diff --git a/sys/services/restic/default.nix b/sys/services/restic/default.nix
index f79f734..77ff40e 100644
--- a/sys/services/restic/default.nix
+++ b/sys/services/restic/default.nix
@@ -1,11 +1,18 @@
-{config, ...}: {
+{
+  config,
+  pkgs,
+  ...
+}: {
   services.restic.backups = let
-    homeDir = "/home/sils";
+    homeDir = "/srv/snapshots/home/sils";
     srvDir = "${homeDir}/srv";
     boxUser = "u384702-sub1";
   in {
     storagebox = {
       initialize = true;
+      backupPrepareCommand = ''
+        [ -d /srv/snapshots/home ] && ${pkgs.btrfs-progs}/bin/btrfs subvolume delete /srv/snapshots/home; ${pkgs.btrfs-progs}/bin/btrfs subvolume snapshot -r /home /srv/snapshots/home;
+      '';
       paths = [
         srvDir
         "${homeDir}/schule"