2017-11-02 17:42:07 +01:00
|
|
|
{ stdenv, lib, buildFHSUserEnv, writeScript, makeDesktopItem }:
|
2012-02-24 18:53:19 +01:00
|
|
|
|
2017-11-02 17:42:07 +01:00
|
|
|
let platforms = [ "i686-linux" "x86_64-linux" ]; in
|
2015-02-24 18:12:56 +01:00
|
|
|
|
2018-08-20 21:11:29 +02:00
|
|
|
assert lib.elem stdenv.hostPlatform.system platforms;
|
2012-02-24 18:53:19 +01:00
|
|
|
|
2017-11-02 17:42:07 +01:00
|
|
|
# Dropbox client to bootstrap installation.
|
|
|
|
# The client is self-updating, so the actual version may be newer.
|
2012-02-24 18:53:19 +01:00
|
|
|
let
|
2019-10-31 20:43:11 +01:00
|
|
|
version = "83.4.152";
|
2017-08-11 10:00:06 +02:00
|
|
|
|
|
|
|
arch = {
|
2019-08-13 23:52:01 +02:00
|
|
|
x86_64-linux = "x86_64";
|
|
|
|
i686-linux = "x86";
|
2018-08-20 21:11:29 +02:00
|
|
|
}.${stdenv.hostPlatform.system};
|
2012-02-24 18:53:19 +01:00
|
|
|
|
2017-11-02 17:42:07 +01:00
|
|
|
installer = "https://clientupdates.dropboxstatic.com/dbx-releng/client/dropbox-lnx.${arch}-${version}.tar.gz";
|
|
|
|
in
|
2012-02-24 18:53:19 +01:00
|
|
|
|
2017-11-02 17:42:07 +01:00
|
|
|
let
|
2012-02-24 18:53:19 +01:00
|
|
|
desktopItem = makeDesktopItem {
|
|
|
|
name = "dropbox";
|
|
|
|
exec = "dropbox";
|
2015-12-13 00:26:41 +01:00
|
|
|
comment = "Sync your files across computers and to the web";
|
2012-02-24 18:53:19 +01:00
|
|
|
desktopName = "Dropbox";
|
2015-12-13 00:26:41 +01:00
|
|
|
genericName = "File Synchronizer";
|
|
|
|
categories = "Network;FileTransfer;";
|
|
|
|
startupNotify = "false";
|
2012-02-24 18:53:19 +01:00
|
|
|
};
|
2017-11-02 17:42:07 +01:00
|
|
|
in
|
2012-02-24 18:53:19 +01:00
|
|
|
|
2017-11-02 17:42:07 +01:00
|
|
|
buildFHSUserEnv {
|
|
|
|
name = "dropbox";
|
2012-02-24 18:53:19 +01:00
|
|
|
|
2018-03-13 11:16:03 +01:00
|
|
|
targetPkgs = pkgs: with pkgs; with xorg; [
|
2017-11-02 17:42:07 +01:00
|
|
|
libICE libSM libX11 libXcomposite libXdamage libXext libXfixes libXrender
|
2017-11-16 16:26:29 +01:00
|
|
|
libXxf86vm libxcb xkeyboardconfig
|
2017-11-17 19:00:20 +01:00
|
|
|
curl dbus firefox-bin fontconfig freetype gcc glib gnutar libxml2 libxslt
|
2019-06-03 11:57:15 +02:00
|
|
|
procps zlib mesa libxshmfence libpthreadstubs libappindicator
|
2017-11-02 17:42:07 +01:00
|
|
|
];
|
2017-03-29 14:23:27 +02:00
|
|
|
|
2017-11-02 17:42:07 +01:00
|
|
|
extraInstallCommands = ''
|
2014-06-30 14:56:10 +02:00
|
|
|
mkdir -p "$out/share/applications"
|
2013-01-21 11:20:30 +01:00
|
|
|
cp "${desktopItem}/share/applications/"* $out/share/applications
|
2015-09-27 19:14:51 +02:00
|
|
|
'';
|
2015-05-18 22:36:49 +02:00
|
|
|
|
2017-11-02 17:42:07 +01:00
|
|
|
runScript = writeScript "install-and-start-dropbox" ''
|
2017-11-17 19:00:20 +01:00
|
|
|
export BROWSER=firefox
|
|
|
|
|
2017-11-17 18:47:55 +01:00
|
|
|
set -e
|
|
|
|
|
|
|
|
do_install=
|
2017-11-02 17:42:07 +01:00
|
|
|
if ! [ -d "$HOME/.dropbox-dist" ]; then
|
2017-11-17 18:47:55 +01:00
|
|
|
do_install=1
|
|
|
|
else
|
|
|
|
installed_version=$(cat "$HOME/.dropbox-dist/VERSION")
|
2017-12-05 00:54:48 +01:00
|
|
|
latest_version=$(printf "${version}\n$installed_version\n" | sort -rV | head -n 1)
|
2017-11-17 18:47:55 +01:00
|
|
|
if [ "x$installed_version" != "x$latest_version" ]; then
|
|
|
|
do_install=1
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -n "$do_install" ]; then
|
|
|
|
installer=$(mktemp)
|
2017-11-02 17:42:07 +01:00
|
|
|
# Dropbox is not installed.
|
|
|
|
# Download and unpack the client. If a newer version is available,
|
|
|
|
# the client will update itself when run.
|
2017-11-17 18:47:55 +01:00
|
|
|
curl '${installer}' >"$installer"
|
|
|
|
pkill dropbox || true
|
|
|
|
rm -fr "$HOME/.dropbox-dist"
|
|
|
|
tar -C "$HOME" -x -z -f "$installer"
|
|
|
|
rm "$installer"
|
2017-11-02 17:42:07 +01:00
|
|
|
fi
|
2017-11-17 18:47:55 +01:00
|
|
|
|
2017-11-17 18:48:34 +01:00
|
|
|
exec "$HOME/.dropbox-dist/dropboxd" "$@"
|
2012-02-24 18:53:19 +01:00
|
|
|
'';
|
|
|
|
|
2017-08-11 10:00:06 +02:00
|
|
|
meta = with lib; {
|
2012-02-24 18:53:19 +01:00
|
|
|
description = "Online stored folders (daemon version)";
|
2017-11-02 17:42:07 +01:00
|
|
|
homepage = http://www.dropbox.com/;
|
2017-08-11 10:00:06 +02:00
|
|
|
license = licenses.unfree;
|
2017-11-02 17:42:07 +01:00
|
|
|
maintainers = with maintainers; [ ttuegel ];
|
2017-08-11 10:00:06 +02:00
|
|
|
platforms = [ "i686-linux" "x86_64-linux" ];
|
2012-02-24 18:53:19 +01:00
|
|
|
};
|
2012-03-14 22:57:32 +01:00
|
|
|
}
|