Commit 49ab7963ac78

Vincent Demeester <vincent@sbr.pm>
2019-04-15 08:52:20
machine/okinawa: migrate vrsync from honshu
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent 9b1f587
Changed files (2)
machine/honshu.nix
@@ -25,25 +25,4 @@ 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/pictures/photos/ vincent@synodine.local:/volumeUSB2/usbshare/pictures/photos/
-/home/vincent/desktop/documents/ vincent@synodine.local:/volume1/documents/
-/run/media/vincent/FcCuir/music/ vincent@synodine.local:/volumeUSB2/usbshare/music/
-  '';
-  systemd.services.vrsync = {
-    description = "vrsync - sync folders to NAS";
-    wantedBy = [ "multi-user.target" ];
-    restartIfChanged = false;
-    startAt = "daily";
-    serviceConfig = {
-      Type = "oneshot";
-      ExecStart = "${pkgs.vrsync}/bin/vrsync";
-      Environment = "PATH=/run/current-system/sw/bin";
-      OnFailure = "status-email-root@%n.service";
-    };
-  };
 }
machine/okinawa.nix
@@ -99,6 +99,33 @@ 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/
+/mnt/nyan/photos/ vincent@synodine.local:/volumeUSB2/usbshare/pictures/photos/
+/mnt/nyan/music/ vincent@synodine.local:/volumeUSB2/usbshare/music/
+  '';
+  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 ];
+    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";
@@ -108,8 +135,11 @@ with import ../assets/machines.nix; {
     restartIfChanged = false;
     unitConfig.X-StopOnRemoval = false;
 
-    serviceConfig.Type = "oneshot";
-    serviceConfig.User = "vincent";
+    serviceConfig = {
+      Type = "oneshot";
+      User = "vincent";
+      OnFailure = "status-email-root@%n.service";
+    };
 
     path = with pkgs; [ git ];
     script = ''