···
1
-
{ mkDerivation, stdenv, lib, fetchurl, makeDesktopItem
2
-
, makeWrapper, patchelf
3
-
, dbus_libs, fontconfig, freetype, gcc, glib
4
-
, libdrm, libffi, libICE, libSM
5
-
, libX11, libXcomposite, libXext, libXmu, libXrender, libxcb
6
-
, libxml2, libxslt, ncurses, zlib
7
-
, qtbase, qtdeclarative, qtwebkit, wmctrl
1
+
{ stdenv, lib, buildFHSUserEnv, writeScript, makeDesktopItem }:
10
-
# this package contains the daemon version of dropbox
11
-
# it's unfortunately closed source
13
-
# note: the resulting program has to be invoced as
14
-
# 'dropbox' because the internal python engine takes
15
-
# uses the name of the program as starting point.
3
+
let platforms = [ "i686-linux" "x86_64-linux" ]; in
17
-
# Dropbox ships with its own copies of some libraries.
18
-
# Unfortunately, upstream makes changes to the source of
19
-
# some libraries, rendering them incompatible with the
20
-
# open-source versions. Wherever possible, we must try
21
-
# to make the bundled libraries work, rather than replacing
22
-
# them with our own.
5
+
assert lib.elem stdenv.system platforms;
7
+
# Dropbox client to bootstrap installation.
8
+
# The client is self-updating, so the actual version may be newer.
25
-
## Prefetch commands to run after update, from this directory:
26
-
## e.g. with Emacs: C-u M-x shell-command
27
-
# nix-prefetch-url ../../../../ -A dropbox.src
28
-
# nix-prefetch-url ../../../../ -A pkgsi686Linux.dropbox.src
30
-
# NOTE: When updating, please also update in current stable,
31
-
# as older versions stop working
32
-
version = "37.4.29";
34
-
"x86_64-linux" = "0ymy8gb57bjq2mq35n52q2viww6am7wy0vskyvypliicggga8iaj";
35
-
"i686-linux" = "0a7zir6x7z3ad71fj1iljc2l6x09f4wi40jfaiinf8ykx85cldw6";
36
-
}."${stdenv.system}" or (throw "system ${stdenv.system} not supported");
10
+
version = "38.4.27";
"x86_64-linux" = "x86_64";
41
-
}."${stdenv.system}" or (throw "system ${stdenv.system} not supported");
43
-
# relative location where the dropbox libraries are stored
44
-
appdir = "opt/dropbox";
17
+
installer = "https://clientupdates.dropboxstatic.com/dbx-releng/client/dropbox-lnx.${arch}-${version}.tar.gz";
47
-
dbus_libs fontconfig freetype gcc.cc glib libdrm libffi libICE libSM
48
-
libX11 libXcomposite libXext libXmu libXrender libxcb libxml2 libxslt
51
-
qtbase qtdeclarative qtwebkit
53
-
ldpath = stdenv.lib.makeLibraryPath libs;
desktopItem = makeDesktopItem {
···
categories = "Network;FileTransfer;";
66
-
name = "dropbox-${version}";
68
-
name = "dropbox-${version}.tar.gz";
69
-
url = "https://clientupdates.dropboxstatic.com/dbx-releng/client/dropbox-lnx.${arch}-${version}.tar.gz";
73
-
sourceRoot = ".dropbox-dist";
75
-
nativeBuildInputs = [ makeWrapper patchelf ];
77
-
dontStrip = true; # already done
82
-
mkdir -p "$out/${appdir}"
83
-
cp -r --no-preserve=mode "dropbox-lnx.${arch}-${version}"/* "$out/${appdir}/"
85
-
# Vendored libraries interact poorly with our graphics drivers
86
-
rm "$out/${appdir}/libdrm.so.2"
87
-
rm "$out/${appdir}/libffi.so.6"
88
-
rm "$out/${appdir}/libGL.so.1"
89
-
rm "$out/${appdir}/libX11-xcb.so.1"
91
-
# Cannot use vendored Qt libraries due to problem with xkbcommon
92
-
rm "$out/${appdir}/"libQt5*.so.5
93
-
rm "$out/${appdir}/qt.conf"
94
-
rm -fr "$out/${appdir}/plugins"
35
+
targetPkgs = pkgs: with pkgs; with xlibs; [
36
+
libICE libSM libX11 libXcomposite libXdamage libXext libXfixes libXrender
38
+
curl dbus fontconfig freetype gcc glib gnutar libxml2 libxslt zlib
41
+
extraInstallCommands = ''
mkdir -p "$out/share/applications"
cp "${desktopItem}/share/applications/"* $out/share/applications
99
-
mkdir -p "$out/share/icons"
100
-
ln -s "$out/${appdir}/images/hicolor" "$out/share/icons/hicolor"
102
-
mkdir -p "$out/bin"
103
-
RPATH="${ldpath}:$out/${appdir}"
104
-
chmod 755 $out/${appdir}/dropbox
105
-
makeWrapper "$out/${appdir}/dropbox" "$out/bin/dropbox" \
106
-
--prefix LD_LIBRARY_PATH : "$RPATH"
109
-
rm $out/${appdir}/wmctrl
110
-
ln -s ${wmctrl}/bin/wmctrl $out/${appdir}/wmctrl
112
-
runHook postInstall
116
-
INTERP=$(cat $NIX_CC/nix-support/dynamic-linker)
117
-
RPATH="${ldpath}:$out/${appdir}"
118
-
getType='s/ *Type: *\([A-Z]*\) (.*/\1/'
119
-
find "$out/${appdir}" -type f -print | while read obj; do
120
-
dynamic=$(readelf -S "$obj" 2>/dev/null | grep "DYNAMIC" || true)
121
-
if [[ -n "$dynamic" ]]; then
123
-
if readelf -l "$obj" 2>/dev/null | grep "INTERP" >/dev/null; then
124
-
echo "patching interpreter path in $type $obj"
125
-
patchelf --set-interpreter "$INTERP" "$obj"
128
-
type=$(readelf -h "$obj" 2>/dev/null | grep 'Type:' | sed -e "$getType")
129
-
if [ "$type" == "EXEC" ] || [ "$type" == "DYN" ]; then
131
-
echo "patching RPATH in $type $obj"
132
-
oldRPATH=$(patchelf --print-rpath "$obj")
133
-
patchelf --set-rpath "''${oldRPATH:+$oldRPATH:}$RPATH" "$obj"
137
-
echo "unknown ELF type \"$type\"; not patching $obj"
143
-
paxmark m $out/${appdir}/dropbox
46
+
runScript = writeScript "install-and-start-dropbox" ''
47
+
if ! [ -d "$HOME/.dropbox-dist" ]; then
48
+
# Dropbox is not installed.
49
+
# Download and unpack the client. If a newer version is available,
50
+
# the client will update itself when run.
51
+
curl '${installer}' | tar -C "$HOME" -x -z
53
+
exec "$HOME/.dropbox-dist/dropboxd"
description = "Online stored folders (daemon version)";
148
-
homepage = http://www.dropbox.com;
149
-
maintainers = with maintainers; [ ttuegel ];
58
+
homepage = http://www.dropbox.com/;
license = licenses.unfree;
60
+
maintainers = with maintainers; [ ttuegel ];
platforms = [ "i686-linux" "x86_64-linux" ];