1 { stdenv, lib, buildFHSEnv, writeScript, makeDesktopItem }:
3 let platforms = [ "i686-linux" "x86_64-linux" ]; in
5 assert lib.elem stdenv.hostPlatform.system platforms;
7 # Dropbox client to bootstrap installation.
8 # The client is self-updating, so the actual version may be newer.
10 version = "206.3.6386";
13 x86_64-linux = "x86_64";
15 }.${stdenv.hostPlatform.system};
17 installer = "https://clientupdates.dropboxstatic.com/dbx-releng/client/dropbox-lnx.${arch}-${version}.tar.gz";
19 desktopItem = makeDesktopItem {
22 comment = "Sync your files across computers and to the web";
23 desktopName = "Dropbox";
24 genericName = "File Synchronizer";
25 categories = [ "Network" "FileTransfer" ];
26 startupNotify = false;
34 # The dropbox-cli command `dropbox start` starts the dropbox daemon in a
35 # separate session, and wants the daemon to outlive the launcher. Enabling
36 # `--die-with-parent` defeats this and causes the daemon to exit when
38 dieWithParent = false;
40 # dropbox-cli (i.e. nautilus-dropbox) needs the PID to confirm dropbox is running.
41 # Dropbox's internal limit-to-one-instance check also relies on the PID.
44 targetPkgs = pkgs: with pkgs; with xorg; [
45 libICE libSM libX11 libXcomposite libXdamage libXext libXfixes libXrender
46 libXxf86vm libGL libxcb xkeyboardconfig
47 curl dbus firefox-bin fontconfig freetype gcc glib gnutar libxml2 libxslt
48 procps zlib mesa libxshmfence libpthreadstubs libappindicator
51 extraInstallCommands = ''
52 mkdir -p "$out/share/applications"
53 cp "${desktopItem}/share/applications/"* $out/share/applications
56 runScript = writeScript "install-and-start-dropbox" ''
57 export BROWSER=firefox
62 if ! [ -d "$HOME/.dropbox-dist" ]; then
65 installed_version=$(cat "$HOME/.dropbox-dist/VERSION")
66 latest_version=$(printf "${version}\n$installed_version\n" | sort -rV | head -n 1)
67 if [ "x$installed_version" != "x$latest_version" ]; then
72 if [ -n "$do_install" ]; then
74 # Dropbox is not installed.
75 # Download and unpack the client. If a newer version is available,
76 # the client will update itself when run.
77 curl '${installer}' >"$installer"
79 rm -fr "$HOME/.dropbox-dist"
80 tar -C "$HOME" -x -z -f "$installer"
84 exec "$HOME/.dropbox-dist/dropboxd" "$@"
88 description = "Online stored folders (daemon version)";
89 homepage = "http://www.dropbox.com/";
90 license = licenses.unfree;
91 maintainers = with maintainers; [ ttuegel ];
92 platforms = [ "i686-linux" "x86_64-linux" ];
93 mainProgram = "dropbox";