about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEmile <git@emile.space>2025-04-12 20:32:56 +0200
committerEmile <git@emile.space>2025-04-12 20:32:56 +0200
commitfdb2809ac6d91863bf4a46d5bb2c4a3bdf2d4f92 (patch)
tree275ed36f7946690ee35d3d7220d94a4b5df92dfd
parent460e14ff9863be1a350b65402302947108f2afef (diff)
(corrino) restic backups for minecraft
-rw-r--r--nix/hosts/corrino/configuration.nix26
-rw-r--r--nix/hosts/corrino/www/mc.emile.space.nix14
2 files changed, 33 insertions, 7 deletions
diff --git a/nix/hosts/corrino/configuration.nix b/nix/hosts/corrino/configuration.nix
index 4628ea5..2f8954b 100644
--- a/nix/hosts/corrino/configuration.nix
+++ b/nix/hosts/corrino/configuration.nix
@@ -557,13 +557,25 @@ in
     };
 
     "/mnt/storagebox-bx11" = {
-      device = "//u331921.your-storagebox.de/backup";
-      fsType = "cifs";
-      options =
-        let
-          automount_opts = "_netdev,x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
-        in
-        [ "${automount_opts},credentials=${config.age.secrets.storage_box_bx11_password.path}" ];
+      device = "u331921@u331921.your-storagebox.de:/home/backup";
+      fsType = "sshfs";
+      options = [ # Filesystem options
+        "allow_other"          # for non-root access
+        "_netdev"              # this is a network fs
+
+        # We don't mount on demand, as that will cause services like navidrome to fail
+        # as the share doesn't yet exist.
+        #"x-systemd.automount" # mount on demand, rather than boot
+
+        #"debug"               # print debug logging
+                               # warning: this causes the one-shot service to never exit
+
+        # SSH options
+        "StrictHostKeyChecking=no"  # prevent the connection from failing if the host's key hasn't been trusted yet
+        "ServerAliveInterval=15" # keep connections alive
+        "Port=23"
+        "IdentityFile=/root/.ssh/id_ed25519"
+      ];
     };
   };
 
diff --git a/nix/hosts/corrino/www/mc.emile.space.nix b/nix/hosts/corrino/www/mc.emile.space.nix
index 0a5bf7e..8250a1d 100644
--- a/nix/hosts/corrino/www/mc.emile.space.nix
+++ b/nix/hosts/corrino/www/mc.emile.space.nix
@@ -133,4 +133,18 @@
      
     addons = {};
   };
+
+  services.restic.backups."minecraft" = {
+    repository = "/mnt/storagebox-bx11/minecraft";
+    paths = [ "/var/lib/minecraft" ];
+    timerConfig = null;
+    passwordFile = config.age.secrets.restic_password.path;
+    initialize = true;
+    pruneOpts = [
+      "--keep-daily 7"
+      "--keep-weekly 5"
+      "--keep-monthly 12"
+      "--keep-yearly 75"
+    ];
+  };
 }