Dropbox: Difference between revisions

From NixOS Wiki
imported>Mic92
No edit summary
imported from old wiki
 
(7 intermediate revisions by 5 users not shown)
Line 1: Line 1:
== Using the package ==
== Using the package ==


Install the <code>dropbox</code> package after enabling [https://nixos.wiki/wiki/FAQ#How_can_I_install_a_proprietary_or_unfree_package.3F unfree packages].
Install the <code>dropbox</code> package after enabling [[Unfree software|unfree software]].
Then start the dropbox command, which will download the real dropbox binary and start it.
Then start the dropbox command, which will download the real dropbox binary and start it.


== Configure Dropbox as a Service on NixOS ==
== Configure Dropbox as a Service on NixOS ==
As of right now ( 2019-01-02 ) there is no dropbox module in nixpkgs, however [https://discourse.nixos.org/t/using-dropbox-on-nixos/387/6 peterhoeg at discourse.nixos.org] shared the service code he is using:
As of right now (19 Jun 2022) there is no dropbox module in nixpkgs, however [https://discourse.nixos.org/t/using-dropbox-on-nixos/387/6 peterhoeg at discourse.nixos.org] shared the service code he is using:


<syntaxHighlight lang=nix>
<syntaxHighlight lang=nix>
Line 27: Line 27:
     };
     };
     serviceConfig = {
     serviceConfig = {
       ExecStart = "${pkgs.dropbox.out}/bin/dropbox";
       ExecStart = "${lib.getBin pkgs.dropbox}/bin/dropbox";
       ExecReload = "${pkgs.coreutils.out}/bin/kill -HUP $MAINPID";
       ExecReload = "${lib.getBin pkgs.coreutils}/bin/kill -HUP $MAINPID";
       KillMode = "control-group"; # upstream recommends process
       KillMode = "control-group"; # upstream recommends process
       Restart = "on-failure";
       Restart = "on-failure";
Line 38: Line 38:
}
}
</syntaxHighlight>
</syntaxHighlight>
A [https://github.com/NixOS/nixpkgs/pull/85699 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.
== Configure Dropbox as a Service in HomeManager ==
The dropbox package is better maintained than the dropbox-cli package. The follow sets up dropbox as a service in home manager (working in Sept. 2024).
<syntaxHighlight lang=nix>
{
    systemd.user.services.dropbox = {
        Unit = {
            Description = "Dropbox service";
        };
        Install = {
            WantedBy = [ "default.target" ];
        };
        Service = {
            ExecStart = "${pkgs.dropbox}/bin/dropbox";
            Restart = "on-failure";
        };
    };
}
</syntaxHighlight>
== Alternative Open Source Client ==
There is also an open source alternative called [https://maestral.app/ Maestral]: <code>maestral</code> as CLI and <code>maestral-gui</code> for a GUI.
[[Category:Applications]]

Latest revision as of 14:35, 8 October 2024

Using the package

Install the dropbox package after enabling unfree software. 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 = "${lib.getBin pkgs.dropbox}/bin/dropbox";
      ExecReload = "${lib.getBin pkgs.coreutils}/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.

Configure Dropbox as a Service in HomeManager

The dropbox package is better maintained than the dropbox-cli package. The follow sets up dropbox as a service in home manager (working in Sept. 2024).

{
    systemd.user.services.dropbox = {
        Unit = {
            Description = "Dropbox service";
        };
        Install = {
            WantedBy = [ "default.target" ];
        };
        Service = {
            ExecStart = "${pkgs.dropbox}/bin/dropbox";
            Restart = "on-failure";
        };
    };
}

Alternative Open Source Client

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