oignon: enable bcc
[julm/julm-nix.git] / hosts / patate / backup / rsync-backup.nix
index 9133fdc0b93d17387e6d7fb3ec8e309cf691b809..0599b6e1dfbf1616a06d1f9f3d17b0a92a88ad2c 100644 (file)
@@ -18,9 +18,6 @@ home-manager.users.sevy = {
           -u rsync-backup@$FS_LABEL"
       '' + " %I";
     };
-    Install = {
-      WantedBy = [ "graphical-session.target" ];
-    };
   };
   systemd.user.services."rsync-backup@" = {
     Unit = {
@@ -34,8 +31,12 @@ home-manager.users.sevy = {
       ExecStart = pkgs.writeShellScript "rsync-backup" ''
         FS_LABEL=$1
         set -eux
-        DEVICE=$(${pkgs.util-linux}/bin/blkid -l -o device -t LABEL="$FS_LABEL")
-        ${pkgs.glib}/bin/gio mount --device "$DEVICE"
+        # FIXME: utillinux -> unit-linux when updating to 20.05
+        DEVICE=$(${pkgs.utillinux}/bin/blkid -l -o device -t LABEL="$FS_LABEL")
+        while ! ${pkgs.glib}/bin/gio mount --device "$DEVICE"
+          do test ! -d /run/media/sevy/"$FS_LABEL" || break
+             sleep 1
+          done
         ${pkgs.rsync}/bin/rsync --verbose --itemize-changes \
           --partial --recursive --times \
           --compress-level=0 --delete --delete-before \