dropbox-cli: Fix and add Nautilus extension

…since this is actually dropbox-nautilus project.

In one of the previous updates, the source code responsible for finding dropboxd
was changed, rendering our sed replacement not working. That triggered the installer
which in turn failed on the unavailability of gobject-introspection typelibs. And
when that was fixed, we got bitten by our lazy packaging putting a broken code
into the installer.

This is a proper fix for all the issues, except for making typelibs available to
the installer since we shall use Nix instead.

+59 -20
+48 -20
pkgs/applications/networking/dropbox/cli.nix
··· 1 - { stdenv, pkgconfig, fetchurl, python3, dropbox }: 1 + { stdenv 2 + , substituteAll 3 + , pkgconfig 4 + , fetchurl 5 + , python3 6 + , dropbox 7 + , gtk3 8 + , gnome3 9 + , gdk_pixbuf 10 + , gobject-introspection 11 + }: 12 + 2 13 let 3 14 version = "2019.02.14"; 4 15 dropboxd = "${dropbox}/bin/dropbox"; ··· 6 17 stdenv.mkDerivation { 7 18 name = "dropbox-cli-${version}"; 8 19 20 + outputs = [ "out" "nautilusExtension" ]; 21 + 9 22 src = fetchurl { 10 23 url = "https://linux.dropboxstatic.com/packages/nautilus-dropbox-${version}.tar.bz2"; 11 24 sha256 = "09yg7q45sycl88l3wq0byz4a9k6sxx3m0r3szinvisfay9wlj35f"; 12 25 }; 13 26 14 - nativeBuildInputs = [ pkgconfig ]; 15 - buildInputs = [ python3 ]; 27 + strictDeps = true; 16 28 17 - phases = "unpackPhase installPhase"; 29 + patches = [ 30 + (substituteAll { 31 + src = ./fix-cli-paths.patch; 32 + inherit dropboxd; 33 + }) 34 + ]; 18 35 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 - ''; 36 + nativeBuildInputs = [ 37 + pkgconfig 38 + gobject-introspection 39 + gdk_pixbuf 40 + # only for build, the install command also wants to use GTK through introspection 41 + # but we are using Nix for installation so we will not need that. 42 + (python3.withPackages (ps: with ps; [ 43 + docutils 44 + pygobject3 45 + ])) 46 + ]; 47 + 48 + buildInputs = [ 49 + python3 50 + gtk3 51 + gnome3.nautilus 52 + ]; 53 + 54 + configureFlags = [ 55 + "--with-nautilus-extension-dir=${placeholder ''nautilusExtension''}/lib/nautilus/extensions-3.0" 56 + ]; 57 + 58 + makeFlags = [ 59 + "EMBLEM_DIR=${placeholder ''nautilusExtension''}/share/nautilus-dropbox/emblems" 60 + ]; 33 61 34 62 meta = { 35 - homepage = http://dropbox.com; 63 + homepage = https://www.dropbox.com; 36 64 description = "Command line client for the dropbox daemon"; 37 - license = stdenv.lib.licenses.gpl3; 65 + license = stdenv.lib.licenses.gpl3Plus; 38 66 maintainers = with stdenv.lib.maintainers; [ the-kenny ]; 39 67 # NOTE: Dropbox itself only works on linux, so this is ok. 40 68 platforms = stdenv.lib.platforms.linux;
+11
pkgs/applications/networking/dropbox/fix-cli-paths.patch
··· 1 + --- a/dropbox.in 2 + +++ b/dropbox.in 3 + @@ -71,7 +71,7 @@ 4 + 5 + PARENT_DIR = os.path.expanduser("~") 6 + DROPBOX_DIST_PATH = "%s/.dropbox-dist" % PARENT_DIR 7 + -DROPBOXD_PATH = os.path.join(DROPBOX_DIST_PATH, "dropboxd") 8 + +DROPBOXD_PATH = "@dropboxd@" 9 + DESKTOP_FILE = "@DESKTOP_FILE_DIR@/dropbox.desktop" 10 + 11 + enc = locale.getpreferredencoding()