From e5ff84a9ade0d9018975b8ba990db4e1b224bfd4 Mon Sep 17 00:00:00 2001
From: sils <sils@sils.li>
Date: Fri, 19 Jan 2024 12:05:42 +0100
Subject: fix(system/services/restic): create /srv/snapshots if non-existent

---
 system/services/restic/default.nix | 1 +
 1 file changed, 1 insertion(+)

(limited to 'system')

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;
 
-- 
cgit 1.4.1