From 390a6f438118bb006946a3cd4fc22aa463bd6842 Mon Sep 17 00:00:00 2001 From: Aly Raffauf Date: Wed, 22 May 2024 16:48:18 -0400 Subject: [PATCH] mauville: add systemd service for backblaze backups --- hosts/mauville/home.nix | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/hosts/mauville/home.nix b/hosts/mauville/home.nix index 7b44639f..3558ae89 100644 --- a/hosts/mauville/home.nix +++ b/hosts/mauville/home.nix @@ -14,7 +14,30 @@ alyraffauf.desktop.sway.autoSuspend = false; } ]; - users.aly = import ../../aly.nix; + users.aly = { + imports = [../../aly.nix]; + systemd.user.services.backblaze-sync = { + Unit = { + Description = "Push Syncthing folers to Backblaze."; + }; + Install = { + WantedBy = ["default.target"]; + }; + Service = { + ExecStart = "${pkgs.writeShellScript "backblaze-sync" '' + #!/run/current-system/sw/bin/bash + + BACKBLAZE=${lib.getExe pkgs.backblaze-b2} + + $BACKBLAZE sync --delete /mnt/Media/Music b2://aly-music + $BACKBLAZE sync --delete /mnt/Media/Audiobooks b2://aly-audiobooks + $BACKBLAZE sync --delete /mnt/Archive/Archive b2://aly-archive + + $BACKBLAZE sync --delete /home/aly/sync b2://aly-sync + ''}"; + }; + }; + }; users.dustin = import ../../dustin.nix; }; }