Commit 4a1875bd5939

Vincent Demeester <vincent@sbr.pm>
2019-07-03 16:32:58
machines/{hokkaido,okinawa}: move ape/vrsync backups around
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 8e916e0
Changed files (3)
machine/hokkaido.nix
@@ -34,4 +34,51 @@ with import ../assets/machines.nix; {
       endpointPublicKey = wireguard.kerkouane.publicKey;
     };
   };
+  # -----------------------------------
+  environment.etc."vrsync".text = ''
+/home/vincent/desktop/pictures/screenshots/ vincent@synodine.local:/volumeUSB2/usbshare/pictures/screenshots/
+/home/vincent/desktop/pictures/wallpapers/ vincent@synodine.local:/volumeUSB2/usbshare/pictures/wallpapers/
+/home/vincent/desktop/documents/ vincent@synodine.local:/volume1/documents/
+  '';
+  systemd.services.vrsync = {
+    description = "vrsync - sync folders to NAS";
+    requires = [ "network-online.target" ];
+    after    = [ "network-online.target" ];
+
+    unitConfig.X-StopOnRemoval = false;
+    restartIfChanged = false;
+
+    path = with pkgs; [ rsync coreutils bash openssh ];
+    script = ''
+    ${pkgs.vrsync}/bin/vrsync
+    '';
+
+    startAt = "hourly";
+    serviceConfig = {
+      Type = "oneshot";
+      OnFailure = "status-email-root@%n.service";
+    };
+  };
+  # ape – sync git mirrors
+  systemd.services.ape = {
+    description = "Ape - sync git mirrors";
+    requires = [ "network-online.target" ];
+    after    = [ "network-online.target" ];
+
+    restartIfChanged = false;
+    unitConfig.X-StopOnRemoval = false;
+
+    serviceConfig = {
+      Type = "oneshot";
+      User = "vincent";
+      OnFailure = "status-email-root@%n.service";
+    };
+
+    path = with pkgs; [ git ];
+    script = ''
+    ${pkgs.nur.repos.vdemeester.ape}/bin/ape up /home/vincent/var/mirrors
+    '';
+
+    startAt = "hourly";
+  };
 }
machine/okinawa.nix
@@ -107,9 +107,6 @@ with import ../assets/machines.nix; {
   security.apparmor.enable = true;
   # -----------------------------------
   environment.etc."vrsync".text = ''
-/home/vincent/desktop/pictures/screenshots/ vincent@synodine.local:/volumeUSB2/usbshare/pictures/screenshots/
-/home/vincent/desktop/pictures/wallpapers/ vincent@synodine.local:/volumeUSB2/usbshare/pictures/wallpapers/
-/home/vincent/desktop/documents/ vincent@synodine.local:/volume1/documents/
 /mnt/nyan/photos/ vincent@synodine.local:/volumeUSB2/usbshare/pictures/photos/
 /mnt/nyan/music/ vincent@synodine.local:/volumeUSB2/usbshare/music/
   '';
modules/profiles/users.nix
@@ -34,7 +34,7 @@ in
           shell = if config.programs.fish.enable then pkgs.fish else pkgs.zsh;
           initialPassword = "changeMe";
           openssh.authorizedKeys.keys =
-            with import ../../assets/machines.nix; [ ssh.yubikey.key ssh.california.key ssh.wakasu.key ssh.vincent.key ssh.houbeb.key ssh.okinawa.key ];
+            with import ../../assets/machines.nix; [ ssh.yubikey.key ssh.wakasu.key ssh.vincent.key ssh.houbeb.key ssh.hokkaido.key ssh.okinawa.key ];
             subUidRanges = [{ startUid = 100000; count = 65536; }];
             subGidRanges = [{ startGid = 100000; count = 65536; }];
         };