Rclone: Difference between revisions

Revert broken systemd service. I'll figure it out later.
Added systemd service example. SystemD mounts are possible but won't let you use spaces, idk whether to add or not.
Line 38: Line 38:
</syntaxhighlight>
</syntaxhighlight>


Particular concern should be made when uploading such configurations online as your passwords will be plainly visible. It is recommended to instead put  the passwords in a local file if such is needed.  
Particular concern should be made when uploading such configurations online as your passwords will be plainly visible. It is recommended to instead put  the passwords in a local file if such is needed. Keep in mind that if you do output to .config/rclone/rclone.conf, every time you switch your home-manager configuration it will be overwritten. It would be wiser to instead output to a separate file, especially if using SystemD services as in the example below. 
 
<syntaxhighlight lang="nix">
  home.file = {
      ".config/rclone/example.conf".text = ''
[MEGA]
type = fichier
user = foo@bar.com
pass = p4ssw0rd
    '';
  };
 
  systemd.user.services.example-mounts = {
    Unit = {
      Description = "Example programmatic mount configuration with nix and home-manager.";
      After = [ "network-online.target" ];
    };
    Service = {
      Type = "notify";
      ExecStartPre = "/usr/bin/env mkdir -p %h/Example Sync Dir";
      ExecStart = "${pkgs.rclone}/bin/rclone --config=%h/.config/rclone/example.conf --vfs-cache-mode writes --ignore-checksum mount \"fichier:\" \"Example Sync Dir\"";
      ExecStop="/bin/fusermount -u %h/Example Sync Dir/%i";
    };
    Install.WantedBy = [ "default.target" ];
  };
</syntaxhighlight>


   [[Category:Applications]]
   [[Category:Applications]]
[[Category:Backup]]
[[Category:Backup]]