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
|
|
|
|
2017-11-02 17:42:07 +01:00
|
|
|
assert lib.elem stdenv.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
|
2017-11-02 17:42:07 +01:00
|
|
|
version = "38.4.27";
|
2017-08-11 10:00:06 +02:00
|
|
|
|
|
|
|
arch = {
|
|
|
|
"x86_64-linux" = "x86_64";
|
|
|
|
"i686-linux" = "x86";
|
2017-11-02 17:42:07 +01:00
|
|
|
}.${stdenv.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
|
|
|
|
2017-11-02 17:42:07 +01:00
|
|
|
targetPkgs = pkgs: with pkgs; with xlibs; [
|
|
|
|
libICE libSM libX11 libXcomposite libXdamage libXext libXfixes libXrender
|
2017-11-16 16:26:29 +01:00
|
|
|
libXxf86vm libxcb xkeyboardconfig
|
2017-11-17 18:47:55 +01:00
|
|
|
curl dbus fontconfig freetype gcc glib gnutar libxml2 libxslt procps zlib
|
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 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")
|
|
|
|
latest_version=$(printf "${version}\n$installed_version\n" | sort -V | head -n 1)
|
|
|
|
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
|
|
|
}
|