Dropbox

From NixOS Wiki
Revision as of 08:03, 19 June 2022 by imported>Ward (Add note about the dropbox module PR as well as a reference to the open source client alternative)

Using the package

Install the dropbox package after enabling unfree packages. Then start the dropbox command, which will download the real dropbox binary and start it.

Configure Dropbox as a Service on NixOS

As of right now (19 Jun 2022) there is no dropbox module in nixpkgs, however peterhoeg at discourse.nixos.org shared the service code he is using:

{
  environment.systemPackages = with pkgs; [
    # dropbox - we don't need this in the environment. systemd unit pulls it in
    dropbox-cli
  ];

  networking.firewall = {
    allowedTCPPorts = [ 17500 ];
    allowedUDPPorts = [ 17500 ];
  };

  systemd.user.services.dropbox = {
    description = "Dropbox";
    wantedBy = [ "graphical-session.target" ];
    environment = {
      QT_PLUGIN_PATH = "/run/current-system/sw/" + pkgs.qt5.qtbase.qtPluginPrefix;
      QML2_IMPORT_PATH = "/run/current-system/sw/" + pkgs.qt5.qtbase.qtQmlPrefix;
    };
    serviceConfig = {
      ExecStart = "${pkgs.dropbox.out}/bin/dropbox";
      ExecReload = "${pkgs.coreutils.out}/bin/kill -HUP $MAINPID";
      KillMode = "control-group"; # upstream recommends process
      Restart = "on-failure";
      PrivateTmp = true;
      ProtectSystem = "full";
      Nice = 10;
    };
  };
}

A pull request has been created to add Dropbox as a Nixos module which builds on this code snippet (21 Apr 2020). As of 19 Jun 2022, this has not been accepted and has not seen activity in 2 years.

Alternative Open Source Client

There is also an open source alternative called Maestral: maestral as CLI and maestral-qt for a GUI.