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 nativeBuildInputs = [ pkgconfig ];
15 buildInputs = [ python ];
16
17 phases = "unpackPhase installPhase";
18
19 installPhase = ''
20 mkdir -p "$out/bin/" "$out/share/applications"
21 cp data/dropbox.desktop "$out/share/applications"
22 cp -a data/icons "$out/share/icons"
23 find "$out/share/icons" -type f \! -name '*.png' -delete
24 substitute "dropbox.in" "$out/bin/dropbox" \
25 --replace '@PACKAGE_VERSION@' ${version} \
26 --replace '@DESKTOP_FILE_DIR@' "$out/share/applications" \
27 --replace '@IMAGEDATA16@' '"too-lazy-to-fix"' \
28 --replace '@IMAGEDATA64@' '"too-lazy-to-fix"'
29 sed -i 's:db_path = .*:db_path = "${dropboxd}":' $out/bin/dropbox
30 chmod +x "$out/bin/"*
31 patchShebangs "$out/bin"
32 '';
33
34 meta = {
35 homepage = http://dropbox.com;
36 description = "Command line client for the dropbox daemon";
37 license = stdenv.lib.licenses.gpl3;
38 maintainers = with stdenv.lib.maintainers; [ the-kenny ];
39 # NOTE: Dropbox itself only works on linux, so this is ok.
40 platforms = stdenv.lib.platforms.linux;
41 };
42}