summary refs log tree commit diff stats
path: root/system
diff options
context:
space:
mode:
authorAlan Pearce2024-05-31 00:26:30 +0200
committerAlan Pearce2024-05-31 00:26:30 +0200
commitd7cefcf0500f02cd81eeadcde1193618fa6101fb (patch)
treef241e286cbce1e95bdfb31daca08f0402b0aba6c /system
parentf6e78e0b82d886b3b628912a750fcad2ae8ca596 (diff)
downloadnixfiles-d7cefcf0500f02cd81eeadcde1193618fa6101fb.tar.lz
nixfiles-d7cefcf0500f02cd81eeadcde1193618fa6101fb.tar.zst
nixfiles-d7cefcf0500f02cd81eeadcde1193618fa6101fb.zip
nanopi: keep an export of golink data in a git repo
Diffstat (limited to 'system')
-rwxr-xr-xsystem/nanopi.nix21
1 files changed, 21 insertions, 0 deletions
diff --git a/system/nanopi.nix b/system/nanopi.nix
index 53664de1..b4693530 100755
--- a/system/nanopi.nix
+++ b/system/nanopi.nix
@@ -70,6 +70,26 @@ in
     };
   };
 
+  systemd.services.backup-golink = {
+    enable = true;
+    startAt = "daily";
+    description = "Export short links from golink";
+    path = with pkgs; [ curl gitMinimal ];
+    script = ''
+      [ -d golink ] || git init --quiet golink --initial-branch=main --shared=world
+      git config --global user.email linde@alanpearce.eu
+      cd golink
+      curl https://go.${ts_domain}/.export > links.json
+      git add links.json
+      git commit -m $(date +%F)
+    '';
+    serviceConfig = {
+      Type = "oneshot";
+      User = "linde";
+      WorkingDirectory = config.users.users.linde.home;
+    };
+  };
+
   services.journald.extraConfig = ''
     MaxRetentionSec=1 month
   '';
@@ -626,6 +646,7 @@ in
       isSystemUser = true;
       shell = "/bin/sh";
       home = "/srv/backup/linde";
+      homeMode = "755";
       createHome = true;
       packages = with pkgs; [ rdiff-backup ];
       openssh.authorizedKeys.keys = [