1{ stdenv, pkgconfig, fetchurl, python, dropbox }:
2let
3 version = "2015.10.28";
4 dropboxd = "${dropbox}/bin/dropbox";
5in
6stdenv.mkDerivation {
7 name = "dropbox-cli-${version}";
8
9 src = fetchurl {
10 url = "https://linux.dropbox.com/packages/nautilus-dropbox-${version}.tar.bz2";
11 sha256 = "1ai6vi5227z2ryxl403693xi63b42ylyfmzh8hbv4shp69zszm9c";
12 };
13
14 buildInputs = [ pkgconfig python ];
15
16 phases = "unpackPhase installPhase";
17
18 installPhase = ''
19 mkdir -p "$out/bin/" "$out/share/applications"
20 cp data/dropbox.desktop "$out/share/applications"
21 cp -a data/icons "$out/share/icons"
22 find "$out/share/icons" -type f \! -name '*.png' -delete
23 substitute "dropbox.in" "$out/bin/dropbox" \
24 --replace '@PACKAGE_VERSION@' ${version} \
25 --replace '@DESKTOP_FILE_DIR@' "$out/share/applications" \
26 --replace '@IMAGEDATA16@' '"too-lazy-to-fix"' \
27 --replace '@IMAGEDATA64@' '"too-lazy-to-fix"'
28 sed -i 's:db_path = .*:db_path = "${dropboxd}":' $out/bin/dropbox
29 chmod +x "$out/bin/"*
30 patchShebangs "$out/bin"
31 '';
32
33 meta = {
34 homepage = http://dropbox.com;
35 description = "Command line client for the dropbox daemon";
36 license = stdenv.lib.licenses.gpl3;
37 maintainers = with stdenv.lib.maintainers; [ the-kenny ];
38 # NOTE: Dropbox itself only works on linux, so this is ok.
39 platforms = stdenv.lib.platforms.linux;
40 };
41}