Dropbox via Maestral#

Dropbox sync on desktop hosts is handled by Maestral — an open-source Dropbox client — run headless as a systemd user service. This replaces the previous com.dropbox.Client flatpak.

Defined in modules/home-manager/desktop.nix and active wherever tsunaminoai.desktop.enable = true.

Why the move#

  • No GUI / display dependency. Maestral’s start -f runs a headless daemon under the user session, with a notify-type unit, a 30 s watchdog, and Restart=on-failure — better suited to an always-on desktop than a flatpak tray app.
  • Native package. Avoids the flatpak sandbox and its XDG_DATA_DIRS / portal quirks; the binary is pinned by the flake like everything else.
  • Same folder. The sync directory stays ~/Dropbox, so nothing downstream changes — including the borg exclude */Dropbox/* and mokou’s bind mount (below).

The service#

# modules/home-manager/desktop.nix
home.packages = [ pkgs.maestral ];

systemd.user.services.maestral = {
  Unit = {
    Description = "Maestral Dropbox client";
    After = [ "network-online.target" ];
    Wants = [ "network-online.target" ];
  };
  Service = {
    Type = "notify";
    NotifyAccess = "exec";
    ExecStart = "${lib.getExe pkgs.maestral} start -f";
    ExecStop = "${lib.getExe pkgs.maestral} stop";
    WatchdogSec = "30s";
    Restart = "on-failure";
    RestartSec = 5;
    Nice = 10;
  };
  Install.WantedBy = [ "default.target" ];
};

The com.dropbox.Client flatpak was removed from the desktop appIds list; see the comment in modules/nixos/flatpak/default.nix.

One-time setup (per host)#

The service won’t start until the account is linked. Maestral can’t be authorised declaratively (it needs an interactive OAuth code), so once per host:

maestral auth link                      # opens a browser; paste the auth code
maestral config set path ~/Dropbox      # reuse the existing folder, don't re-create it
systemctl --user enable --now maestral  # start it and enable on login

Check status with maestral status or systemctl --user status maestral.

Point Maestral at the existing folder

Always maestral config set path ~/Dropbox before the first sync. If Maestral creates a fresh empty ~/Dropbox it can propagate deletions of the existing content to the cloud.

mokou specifics#

On mokou, ~/Dropbox is a bind mount onto /data (the LUKS ext4 disk), keeping the ~62 GB off the cramped btrfs SSD while leaving the path identical:

# hosts/x86_64-nixos/mokou/default.nix
fileSystems."/home/tsunami/Dropbox" = {
  device = "/data/Dropbox";
  fsType = "none";
  options = [ "bind" "nofail" ];
  depends = [ "/data" ];
};

Because the folder already holds the synced data, Maestral indexes it against the cloud and skips re-downloading files that already match — no full re-sync.