about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2024-10-08 19:22:17 -0700
committerFranck Cuny <franck@fcuny.net>2024-10-08 19:22:17 -0700
commit83596ae5f5ed31464013b1d01bc42ce83da0967e (patch)
treec746aeb676a4bc9aab837398e5d405ec067c153a
parentnew ssh public key for my user (diff)
downloadworld-83596ae5f5ed31464013b1d01bc42ce83da0967e.tar.gz
backup the repositories
-rw-r--r--nix/hosts/wildcat/configuration.nix32
1 files changed, 24 insertions, 8 deletions
diff --git a/nix/hosts/wildcat/configuration.nix b/nix/hosts/wildcat/configuration.nix
index 884b292..6078bf7 100644
--- a/nix/hosts/wildcat/configuration.nix
+++ b/nix/hosts/wildcat/configuration.nix
@@ -19,7 +19,8 @@
   # TODO(fcuny): I could create the configuration file to set the default branch
   services.gitolite = {
     enable = true;
-    adminPubkey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINBkozy+X96u5ciX766bJ/AyQ3xm1tXZTIr5+4PVFZFi";
+    adminPubkey =
+      "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINBkozy+X96u5ciX766bJ/AyQ3xm1tXZTIr5+4PVFZFi";
     user = "git";
     group = "git";
     extraGitoliteRc = ''
@@ -46,10 +47,10 @@
       readme = ":README.md";
       project-list = "/var/lib/gitolite/projects.list";
       about-filter = "${pkgs.cgit-pink}/lib/cgit/filters/about-formatting.sh";
-      source-filter = "${pkgs.cgit-pink}/lib/cgit/filters/syntax-highlighting.py";
-      clone-url = (lib.concatStringsSep " " [
-        "https://git.fcuny.net/$CGIT_REPO_URL"
-      ]);
+      source-filter =
+        "${pkgs.cgit-pink}/lib/cgit/filters/syntax-highlighting.py";
+      clone-url =
+        (lib.concatStringsSep " " [ "https://git.fcuny.net/$CGIT_REPO_URL" ]);
       enable-log-filecount = 1;
       enable-log-linecount = 1;
       enable-git-config = 1;
@@ -83,9 +84,7 @@
         forceSSL = true;
         enableACME = true;
         locations = {
-          "/" = {
-            root = "/srv/www/fcuny.net";
-          };
+          "/" = { root = "/srv/www/fcuny.net"; };
           "/.well-known/acme-challenge" = {
             root = "/var/lib/acme/acme-challenges";
           };
@@ -106,4 +105,21 @@
       };
     };
   };
+
+  services.restic.backups.git = {
+    user = "fcuny";
+    passwordFile = "/etc/restic.pw";
+    repository = "/srv/backups/git";
+    initialize = true;
+    paths = [ "/var/lib/gitolite" ];
+    exclude = [ "/var/lib/gitolite/.bash_history" "/var/lib/gitolite/.ssh" ];
+    extraBackupArgs = [ "--exclude-caches" "--compression=max" ];
+    timerConfig = { OnCalendar = "*:0/30"; };
+    pruneOpts = [
+      "--keep-hourly 36"
+      "--keep-daily 7"
+      "--keep-weekly 4"
+      "--keep-monthly 3"
+    ];
+  };
 }