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