Add given password for hosts/aubergine/ssh/host.key to store.
[julm/julm-nix.git] / hosts / patate / backup / rsync-backup.nix
index 3e4b7e1b8b467aeb924d35772d3ab4f4cec2a248..43e22300c0f1268ecdcaed2368a748a75f5f5407 100644 (file)
@@ -1,49 +1,49 @@
-{ pkgs, lib, config, hostName, ... }:
+{ pkgs, ... }:
 with builtins;
 {
-home-manager.users.sevy = {
-  systemd.user.services."rsync-term@" = {
-    Unit = {
-      Description = "rsync terminal for: %I";
-      After = [ "graphical-session.target" ];
-      StopWhenUnneeded = false;
+  home-manager.users.sevy = {
+    systemd.user.services."rsync-term@" = {
+      Unit = {
+        Description = "rsync terminal for: %I";
+        After = [ "graphical-session.target" ];
+        StopWhenUnneeded = false;
+      };
+      Service = {
+        Type = "simple";
+        ExecStart = pkgs.writeShellScript "rsync-term" ''
+          FS_LABEL=$1
+          set -eux
+          ${pkgs.xterm}/bin/xterm -fg white -bg black -fa Monospace -fs 6 \
+            -title "rsync backup to: $FS_LABEL" -e "journalctl --user -f -o short \
+            -u rsync-backup@$FS_LABEL"
+        '' + " %I";
+      };
     };
-    Service = {
-      Type = "simple";
-      ExecStart = pkgs.writeShellScript "rsync-term" ''
-        FS_LABEL=$1
-        set -eux
-        ${pkgs.xterm}/bin/xterm -fg white -bg black -fa Monospace -fs 6 \
-          -title "rsync backup to: $FS_LABEL" -e "journalctl --user -f -o short \
-          -u rsync-backup@$FS_LABEL"
-      '' + " %I";
+    systemd.user.services."rsync-backup@" = {
+      Unit = {
+        Description = "rsync backup: %i";
+        Wants = [ "rsync-term@%i.service" ];
+        BindsTo = [ "sys-subsystem-usb-%i.device" ];
+      };
+      Service = {
+        Type = "oneshot";
+        SyslogIdentifier = "rsync-backup@%i";
+        ExecStart = pkgs.writeShellScript "rsync-backup" ''
+          FS_LABEL=$1
+          set -eux
+          DEVICE=$(${pkgs.util-linux}/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 \
+            /run/media/sevy/"$FS_LABEL" \
+            ~sevy/Documents/
+          systemctl --user --no-block stop rsync-term@"$FS_LABEL"
+        '' + " %I";
+      };
     };
   };
-  systemd.user.services."rsync-backup@" = {
-    Unit = {
-      Description = "rsync backup: %i";
-      Wants = [ "rsync-term@%i.service" ];
-      BindsTo = [ "sys-subsystem-usb-%i.device" ];
-    };
-    Service = {
-      Type = "oneshot";
-      SyslogIdentifier = "rsync-backup@%i";
-      ExecStart = pkgs.writeShellScript "rsync-backup" ''
-        FS_LABEL=$1
-        set -eux
-        DEVICE=$(${pkgs.util-linux}/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 \
-          /run/media/sevy/"$FS_LABEL" \
-          ~sevy/Documents/
-        systemctl --user --no-block stop rsync-term@"$FS_LABEL"
-      '' + " %I";
-    };
-  };
-};
 }