summary refs log tree commit diff stats
path: root/sys
diff options
context:
space:
mode:
authorsils <sils@sils.li>2024-01-06 22:57:48 +0100
committersils <sils@sils.li>2024-01-06 22:57:48 +0100
commit0be51781026d1437244417391f94cbdb0a1fee86 (patch)
treec48a3f6501078c104bf545541999532d8b0243ed /sys
parentfeat(sys/services): add restic (diff)
downloadnix-config-0be51781026d1437244417391f94cbdb0a1fee86.tar.gz
nix-config-0be51781026d1437244417391f94cbdb0a1fee86.zip
fix(sys/services/restic): backup btrfs snapshot
Diffstat (limited to 'sys')
-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"