Ben Juntilla

Dropbox on GNU Guix

I use GNU Guix not out of some puritanism for FOSS ideology, but because I enjoy declarative operating systems, configuring my environment from scratch, and Lisp.

This pragmatism extends to my tooling choices. I use Dropbox for how convenient it makes syncing my photos and Emacs org-mode files across my devices. Plus, using the Organice webapp with the Dropbox backend lets me access TODOs and notes from any machine that doesn't have Emacs installed (particularly my phone, solving what has been a huge pain point with Emacs for me).

But unfortunately, no one has packaged Dropbox for Guix yet (at least not that I could find). Luckily, Dropbox provides Linux builds with headless support for servers, which lets me use it from the comfort of a simple CLI.

Following the instructions, I extracted the proprietary Dropbox binaries to ~/.dropbox-dist:

cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -

And then grabbed the accompanying Python CLI:

wget -O ~/.local/bin/dropbox "https://www.dropbox.com/download?dl=packages/dropbox.py"
chmod +x ~/.local/bin/dropbox

Making It Work

But running dropbox start didn't work out of the box, thanks to some quirks with my setup:

Issue 1: Binary Interpreter

Guix doesn't follow the filesystem hierarchy standard, so foreign binaries need their interpreter patched. This is evidenced by an ambiguous error upon running dropbox start that looks like:

bash: ~/.dropbox-dist/dropboxd: No such file or directory

Thanks to this excellent post I referenced, the fix is straightforward:

patchelf --set-interpreter "$(patchelf --print-interpreter "$(realpath "$(which sh)")")" ~/.dropbox-dist/dropbox-lnx.x86_64-$VERSION/dropbox

Issue 2: Missing Libraries

Next, running dropbox start yielded:

error while loading shared libraries: libstdc++.so.6: cannot open shared object file

You may have other libraries missing in your case.

So I installed gcc-toolchain and modified the dropbox script, adding this line right after def start_dropbox() so the linker can see all the shared objects we have:

os.environ["LD_LIBRARY_PATH"] = os.environ.get("LIBRARY_PATH")

Issue 3: Qt Dependencies

If you're running a setup without Qt libraries (I use niri as my compositor because I'm cool 😎), Dropbox will complain about missing Qt platform plugins:

b'!! (Qt:Fatal) This application failed to start because it could not find or load the Qt platform plugin "xcb".\n\nAvailable platform plugins are: xcb.\n\nReinstalling the application may fix this problem.'

Since we're running headless anyway, you can either set DISPLAY= when running dropbox or find the GUI_AVAILABLE variable in the dropbox script and set it to:

GUI_AVAILABLE = False

fin

Run dropbox start, wait for everything to sync, and voila! Thanks Dropbox for supporting Linux since day one and even making the client controllable by CLI :D

#tuts