Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 141 lines 3.3 kB view raw
1{ 2 stdenv, 3 lib, 4 buildFHSEnv, 5 writeScript, 6 makeDesktopItem, 7}: 8 9# Dropbox client to bootstrap installation. 10# The client is self-updating, so the actual version may be newer. 11let 12 version = 13 { 14 x86_64-linux = "217.4.4417"; 15 i686-linux = "206.3.6386"; 16 } 17 .${stdenv.hostPlatform.system} or ""; 18 19 arch = 20 { 21 x86_64-linux = "x86_64"; 22 i686-linux = "x86"; 23 } 24 .${stdenv.hostPlatform.system}; 25 26 installer = "https://clientupdates.dropboxstatic.com/dbx-releng/client/dropbox-lnx.${arch}-${version}.tar.gz"; 27 28 desktopItem = makeDesktopItem { 29 name = "dropbox"; 30 exec = "dropbox"; 31 comment = "Sync your files across computers and to the web"; 32 desktopName = "Dropbox"; 33 genericName = "File Synchronizer"; 34 categories = [ 35 "Network" 36 "FileTransfer" 37 ]; 38 startupNotify = false; 39 icon = "dropbox"; 40 }; 41in 42 43buildFHSEnv { 44 inherit version; 45 pname = "dropbox"; 46 47 # The dropbox-cli command `dropbox start` starts the dropbox daemon in a 48 # separate session, and wants the daemon to outlive the launcher. Enabling 49 # `--die-with-parent` defeats this and causes the daemon to exit when 50 # dropbox-cli exits. 51 dieWithParent = false; 52 53 # dropbox-cli (i.e. nautilus-dropbox) needs the PID to confirm dropbox is running. 54 # Dropbox's internal limit-to-one-instance check also relies on the PID. 55 unsharePid = false; 56 57 targetPkgs = 58 pkgs: 59 with pkgs; 60 with xorg; 61 [ 62 libICE 63 libSM 64 libX11 65 libXcomposite 66 libXdamage 67 libXext 68 libXfixes 69 libXrender 70 libXmu 71 libXxf86vm 72 libGL 73 libxcb 74 xkeyboardconfig 75 curl 76 dbus 77 firefox-bin 78 fontconfig 79 freetype 80 gcc 81 glib 82 gnutar 83 gtk3 84 libxml2 85 libxslt 86 procps 87 zlib 88 libgbm 89 libxshmfence 90 libpthreadstubs 91 libappindicator 92 ]; 93 94 extraInstallCommands = '' 95 mkdir -p "$out/share/applications" 96 cp "${desktopItem}/share/applications/"* $out/share/applications 97 ''; 98 99 runScript = writeScript "install-and-start-dropbox" '' 100 export BROWSER=firefox 101 102 set -e 103 104 do_install= 105 if ! [ -d "$HOME/.dropbox-dist" ]; then 106 do_install=1 107 else 108 installed_version=$(cat "$HOME/.dropbox-dist/VERSION") 109 latest_version=$(printf "${version}\n$installed_version\n" | sort -rV | head -n 1) 110 if [ "x$installed_version" != "x$latest_version" ]; then 111 do_install=1 112 fi 113 fi 114 115 if [ -n "$do_install" ]; then 116 installer=$(mktemp) 117 # Dropbox is not installed. 118 # Download and unpack the client. If a newer version is available, 119 # the client will update itself when run. 120 curl '${installer}' >"$installer" 121 pkill dropbox || true 122 rm -fr "$HOME/.dropbox-dist" 123 tar -C "$HOME" -x -z -f "$installer" 124 rm "$installer" 125 fi 126 127 exec "$HOME/.dropbox-dist/dropboxd" "$@" 128 ''; 129 130 meta = { 131 description = "Online stored folders (daemon version)"; 132 homepage = "https://www.dropbox.com/"; 133 license = lib.licenses.unfree; 134 maintainers = with lib.maintainers; [ ttuegel ]; 135 platforms = [ 136 "i686-linux" 137 "x86_64-linux" 138 ]; 139 mainProgram = "dropbox"; 140 }; 141}