summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorsils <sils@sils.li>2024-01-19 12:05:42 +0100
committersils <sils@sils.li>2024-01-19 12:07:53 +0100
commite5ff84a9ade0d9018975b8ba990db4e1b224bfd4 (patch)
tree5665f73768073b26738e805e41860d7911c4555b
parentchore(version): v0.20.1 (diff)
downloadnixos-server-e5ff84a9ade0d9018975b8ba990db4e1b224bfd4.tar.gz
nixos-server-e5ff84a9ade0d9018975b8ba990db4e1b224bfd4.zip
fix(system/services/restic): create /srv/snapshots if non-existent
-rw-r--r--system/services/restic/default.nix1
1 files changed, 1 insertions, 0 deletions
diff --git a/system/services/restic/default.nix b/system/services/restic/default.nix
index 3af92a5..cfeaca3 100644
--- a/system/services/restic/default.nix
+++ b/system/services/restic/default.nix
@@ -13,6 +13,7 @@
       backupPrepareCommand = ''
         ${pkgs.sudo}/bin/sudo -u ${postgresUser} ${pkgs.postgresql}/bin/pg_dumpall --clean --if-exists --quote-all-identifiers > /srv/db_backup.sql
 
+        [ -d /srv/snapshots ] || ${pkgs.btrfs-progs}/bin/btrfs subvolume create /srv/snapshots;
         [ -d /srv/snapshots/srv ] && ${pkgs.btrfs-progs}/bin/btrfs subvolume delete /srv/snapshots/srv;
         ${pkgs.btrfs-progs}/bin/btrfs subvolume snapshot -r /srv /srv/snapshots/srv;