about summary refs log tree commit diff
path: root/programs/rclone.nix
diff options
context:
space:
mode:
Diffstat (limited to 'programs/rclone.nix')
-rw-r--r--programs/rclone.nix30
1 files changed, 30 insertions, 0 deletions
diff --git a/programs/rclone.nix b/programs/rclone.nix
new file mode 100644
index 0000000..a8c4782
--- /dev/null
+++ b/programs/rclone.nix
@@ -0,0 +1,30 @@
+{ pkgs, config, ... }:
+
+let
+    mountdir = "${config.home.homeDirectory}/zhr/drive";
+in
+{
+  home.packages = with pkgs; [
+    rclone
+  ];
+
+    systemd.user = {
+        services.gdrive_mount = {
+            Unit = {
+                Description = "mount google-drive dirs";
+            };
+            Install.WantedBy = [ "multi-user.target" ];
+            Service = {
+                # ExecStartPre = "${pkgs.coreutils}/bin/mkdir -p ${mountdir}";
+                ExecStart = ''
+                    ${pkgs.rclone}/bin/rclone mount zhr-drive: ${mountdir}
+                '';
+                # ExecStop = "${pkgs.coreutils}/bin/umount ${mountdir}";
+                Type = "notify";
+                Restart = "always";
+                RestartSec = "10s";
+                Environment = [ "PATH=${pkgs.fuse}/bin:$PATH" ];
+            };
+        };
+    };
+}