From f625eae63eb449ed829cc94eb7c1dbf98fd92cb8 Mon Sep 17 00:00:00 2001
From: notohh <github@notohh.dev>
Date: Tue, 18 Feb 2025 08:18:27 -0500
Subject: [PATCH] tsuki: init immich backup service

---
 hosts/tsuki/services/default.nix       |  1 +
 hosts/tsuki/services/immich-backup.nix | 33 ++++++++++++++++++++++++++
 2 files changed, 34 insertions(+)
 create mode 100644 hosts/tsuki/services/immich-backup.nix

diff --git a/hosts/tsuki/services/default.nix b/hosts/tsuki/services/default.nix
index 17f6759..0ff45e5 100644
--- a/hosts/tsuki/services/default.nix
+++ b/hosts/tsuki/services/default.nix
@@ -4,5 +4,6 @@
     ./atticd.nix
     ./hydroxide.nix
     ./rnnoise.nix
+    ./immich-backup.nix
   ];
 }
diff --git a/hosts/tsuki/services/immich-backup.nix b/hosts/tsuki/services/immich-backup.nix
new file mode 100644
index 0000000..4175bac
--- /dev/null
+++ b/hosts/tsuki/services/immich-backup.nix
@@ -0,0 +1,33 @@
+{
+  lib,
+  pkgs,
+  ...
+}: {
+  systemd = {
+    services.immich-backup = let
+      homeDir = "/home/notoh";
+    in {
+      enable = true;
+      wantedBy = ["multi-user.target"];
+      description = "immich backup service";
+      script = ''
+        ${lib.getExe pkgs.immich-cli} upload --album-name "screenshots" --recursive ${homeDir}/Pictures/screenshots
+      '';
+      environment = {
+        IMMICH_CONFIG_DIR = "${homeDir}/.config/immich";
+      };
+    };
+    timers.immich-backup = {
+      enable = true;
+      wantedBy = ["timers.target"];
+      description = "immich backup timer";
+      timerConfig = {
+        OnCalendar = "*-*-* 00:00:00";
+        Persistent = true;
+      };
+      unitConfig = {
+        Description = "immich backup timer";
+      };
+    };
+  };
+}