From d7cefcf0500f02cd81eeadcde1193618fa6101fb Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Fri, 31 May 2024 00:26:30 +0200 Subject: nanopi: keep an export of golink data in a git repo --- system/nanopi.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'system') 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 = [ -- cgit 1.4.1