|
1 | 1 | { |
2 | 2 | pkgs, |
3 | 3 | config, |
| 4 | + lib, |
4 | 5 | ... |
5 | 6 | }: let |
6 | 7 | mountPoint = "${config.home.homeDirectory}/PrivateGDrive"; |
7 | 8 | in { |
8 | | - systemd.user.services.rclone-gdrive = { |
9 | | - Unit = { |
10 | | - Description = "RClone Mount for Encrypted Google Drive (Zero-Knowledge)"; |
11 | | - After = ["network-online.target" "graphical-session.target"]; |
12 | | - Wants = ["network-online.target"]; |
13 | | - }; |
| 9 | + config = lib.mkIf pkgs.stdenv.isLinux { |
| 10 | + systemd.user.services.rclone-gdrive = { |
| 11 | + Unit = { |
| 12 | + Description = "RClone Mount for Encrypted Google Drive (Zero-Knowledge)"; |
| 13 | + After = ["network-online.target" "graphical-session.target"]; |
| 14 | + Wants = ["network-online.target"]; |
| 15 | + }; |
14 | 16 |
|
15 | | - Service = { |
16 | | - Type = "exec"; |
17 | | - # Create the directory right before mounting |
18 | | - ExecStartPre = "/run/current-system/sw/bin/mkdir -p ${mountPoint}"; |
19 | | - # Optimized for desktop usage: |
20 | | - # - vfs-cache-mode full: Essential for opening files (Office, PDF, etc) directly from the mount |
21 | | - # - vfs-cache-max-size: Limits local SSD usage to 10GB |
22 | | - ExecStart = '' |
23 | | - ${pkgs.rclone}/bin/rclone mount gd-crypt: ${mountPoint} \ |
24 | | - --vfs-cache-mode full \ |
25 | | - --vfs-cache-max-size 10G \ |
26 | | - --vfs-cache-max-age 24h \ |
27 | | - --dir-cache-time 72h \ |
28 | | - --vfs-read-chunk-size 32M \ |
29 | | - --vfs-read-chunk-size-limit 1G \ |
30 | | - --buffer-size 32M \ |
31 | | - --no-modtime |
32 | | - ''; |
33 | | - ExecStop = "${pkgs.fuse}/bin/fusermount -uz ${mountPoint}"; |
34 | | - Restart = "on-failure"; |
35 | | - RestartSec = "10"; |
36 | | - }; |
| 17 | + Service = { |
| 18 | + Type = "exec"; |
| 19 | + # Create the directory right before mounting |
| 20 | + ExecStartPre = "/run/current-system/sw/bin/mkdir -p ${mountPoint}"; |
| 21 | + # Optimized for desktop usage: |
| 22 | + # - vfs-cache-mode full: Essential for opening files (Office, PDF, etc) directly from the mount |
| 23 | + # - vfs-cache-max-size: Limits local SSD usage to 10GB |
| 24 | + ExecStart = '' |
| 25 | + ${pkgs.rclone}/bin/rclone mount gd-crypt: ${mountPoint} \ |
| 26 | + --vfs-cache-mode full \ |
| 27 | + --vfs-cache-max-size 10G \ |
| 28 | + --vfs-cache-max-age 24h \ |
| 29 | + --dir-cache-time 72h \ |
| 30 | + --vfs-read-chunk-size 32M \ |
| 31 | + --vfs-read-chunk-size-limit 1G \ |
| 32 | + --buffer-size 32M \ |
| 33 | + --no-modtime |
| 34 | + ''; |
| 35 | + ExecStop = "${pkgs.fuse}/bin/fusermount -uz ${mountPoint}"; |
| 36 | + Restart = "on-failure"; |
| 37 | + RestartSec = "10"; |
| 38 | + }; |
37 | 39 |
|
38 | | - Install = { |
39 | | - WantedBy = ["default.target"]; |
| 40 | + Install = { |
| 41 | + WantedBy = ["default.target"]; |
| 42 | + }; |
40 | 43 | }; |
41 | 44 | }; |
42 | 45 | } |
0 commit comments