summary refs log tree commit diff stats
path: root/system/services
diff options
context:
space:
mode:
authorSilas Schöffel <sils@sils.li>2025-01-21 21:21:14 +0100
committerSilas Schöffel <sils@sils.li>2025-01-21 21:29:50 +0100
commit1b04a415e98b72841e6b9dba0b0c030428ba0434 (patch)
tree120cd8919c2929255ee8be597fb782d42a453ada /system/services
parentfix(modules/peertube): correct email setup (diff)
downloadnixos-server-1b04a415e98b72841e6b9dba0b0c030428ba0434.zip
feat(modules/backup): init
Diffstat (limited to 'system/services')
-rw-r--r--system/services/default.nix1
-rw-r--r--system/services/restic/default.nix50
2 files changed, 0 insertions, 51 deletions
diff --git a/system/services/default.nix b/system/services/default.nix
index d78ee28..4d3700d 100644
--- a/system/services/default.nix
+++ b/system/services/default.nix
@@ -3,7 +3,6 @@
     ./invidious
     ./mail
     ./minecraft
-    ./restic
     ./taskserver
   ];
 }
diff --git a/system/services/restic/default.nix b/system/services/restic/default.nix
deleted file mode 100644
index cfeaca3..0000000
--- a/system/services/restic/default.nix
+++ /dev/null
@@ -1,50 +0,0 @@
-{
-  config,
-  pkgs,
-  ...
-}: {
-  services.restic.backups = let
-    snapshots = "/srv/snapshots";
-    boxUser = "u384702-sub2";
-    postgresUser = "postgres";
-  in {
-    storagebox = {
-      initialize = true;
-      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;
-
-        # dump() {
-        #   # compression:
-        #   # pg_dump -F t -v "$1" | xz -z -9 -e -T0 > "db_$1.tar.xz"
-        #   pg_dump -v "$1" > "db_$1.tar.xz"
-        # }
-        # # List all databases, and dump each of them in its own file
-        # # psql --list --csv | while read -r line; do echo "$line" | grep ','; done | while IFS=, read -r name _; do  echo "$name"; done | sed '1d' | while read -r db_name; do dump "$db_name"; done
-      '';
-      paths = [
-        snapshots
-      ];
-      exclude = [
-        ".snapshots"
-        "/var/lib/postgresql" # included in the db dump
-      ];
-      extraBackupArgs = [
-        "--verbose" # spam log
-      ];
-      passwordFile = config.age.secrets.resticpass.path;
-      extraOptions = [
-        "rclone.program='ssh -p 23 ${boxUser}@${boxUser}.your-storagebox.de -i ${config.age.secrets.resticssh.path}'"
-      ];
-      repository = "rclone: "; # There is only one repository served
-      timerConfig = {
-        Requires = "network-online.target";
-        OnCalendar = "daily";
-        Persistent = true;
-      };
-    };
-  };
-}