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