Using Dropbox on Nixos


As I’m moving my setup to Nixos, I’m trying to make Dropbox work like on my other computers.

Basically, I’d need Dropbox to start at launch, and integrate with my file manager (which, in my case is Gnome Files, aka Nautilus). There is no Dropbox module that I could find. So the only thing I’ve done so far is adding dropbox to my environment.systemPackages.

This, to be honest, doesn’t work terribly well (I can start dropbox from, say, the command line, but since it doesn’t integrate to my desktop or file manager, I have no way of checking the synchronisation status, and I’m not quite sure this is working properly).

That’s about the state of my knowledge and understanding at this point.

So I’d like to know if the Nixos community has found best practices or neat tricks to make Dropbox pleasant to use on Nixos. I use Gnome, but I’m interested in answers for other setups as well.


I use it quite rarely so just run nix run nixpkgs.dropbox -c dropbox in a Terminal whenever needed. If you want Dropbox to start on user login, something like that should work (not tested):

{ pkgs, config }:
{ = {
    restartIfChanged = true;
    enable = true;
    serviceConfig = {
      ExecStart = "${pkgs.dropbox}/bin/dropbox";
      PassEnvironment = "DISPLAY";


Dropbox has been packaged for caja, which is mate’s nautilus.

Probably the same thing has been not done yet for nautilus.
The package would be here:



This looks almost too easy to be real. But I’ll try to see what I can do with this.


As I am really new to Nixos: could you please give people like me some more information, how you did this?
Would be really kind, since I’m lost how to get my dropbox running on Nixos…


Sure, this is how I use it:

{ config, lib, pkgs, ... }:

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

  networking.firewall = {
    allowedTCPPorts = [ 17500 ];
    allowedUDPPorts = [ 17500 ];
  }; = {
    description = "Dropbox";
    after = [ "xembedsniproxy.service" ];
    wants = [ "xembedsniproxy.service" ];
    wantedBy = [ "" ];
    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;


Let me know if you need any of the parts explained.


Thanks for sharing, i’ve added your code to the nixos wiki:


Thanks a lot, Peter! I couldn’t hav come up with this for a pretty long time…

And here comes the real newbie follow-up question. I almost hesitate to ask, but let it be:
Dropbox provides .deb and .rpm packages for Linux on their donwload page. Since Nixos works differently - how would I go on with the installation?
Maybe there is some help in the manuals or wiki I’ve not found yet?


@mrtn22 Install the dropbox package after you have enabled unfree packages And then start the dropbox command.


It’s also possible to install dropbox using flatpak. Not very nixy I guess, but works.


And that’s really the thing - you shouldn’t have to. We need to collectively get a lot better at making things work out of the box. I shouldn’t have sat on this without either updating the nixos module or at the very least document it.


Wow! nix-env -qaP really opened a completely new world to me.
Thanks a lot!


After reading this I tried to set up dropbox as a systemd user service however this seems to hang on the part where it opens firefox (not visible) to register the deamon with dropbox.

So I opened a nix-shell with the deamon and ran it to do the initial configuration in hopes of the systemd service then just using those generated config files. But it seems this is not the case. At least the PID of the deamon is not set in the respective file and the cli tool says that dropbox isn’t running.

So how do you configure the deamon for use with a systemd user service?


It launches firefox for me to do the login with the config above.


Apart from the KDE specific stuff I use a nearly identical config (without the KDE stuff given that I dont use a desktop environment but standalone Xmonad) but it doesn’t open firefox for me (at least not visible anywhere).

   dropbox = {
      description = "Dropbox";
      enable = true;
      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;

I also tried to include the passing of the DISPLAY variable proposed by zimbatm above but that didn’t change things.

Given that the dropbox config exists in my home directory my understanding is that the firefox step should be skipped anyway, right?