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.
This commit is contained in:
Jan Tojnar 2019-05-02 13:43:07 +02:00
parent aeb464dfd3
commit dd0c105b87
No known key found for this signature in database
GPG Key ID: 7FAB2A15F7A607A4
2 changed files with 59 additions and 20 deletions

View File

@ -1,4 +1,15 @@
{ stdenv, pkgconfig, fetchurl, python3, dropbox }: { stdenv
, substituteAll
, pkgconfig
, fetchurl
, python3
, dropbox
, gtk3
, gnome3
, gdk_pixbuf
, gobject-introspection
}:
let let
version = "2019.02.14"; version = "2019.02.14";
dropboxd = "${dropbox}/bin/dropbox"; dropboxd = "${dropbox}/bin/dropbox";
@ -6,35 +17,52 @@ in
stdenv.mkDerivation { stdenv.mkDerivation {
name = "dropbox-cli-${version}"; name = "dropbox-cli-${version}";
outputs = [ "out" "nautilusExtension" ];
src = fetchurl { src = fetchurl {
url = "https://linux.dropboxstatic.com/packages/nautilus-dropbox-${version}.tar.bz2"; url = "https://linux.dropboxstatic.com/packages/nautilus-dropbox-${version}.tar.bz2";
sha256 = "09yg7q45sycl88l3wq0byz4a9k6sxx3m0r3szinvisfay9wlj35f"; sha256 = "09yg7q45sycl88l3wq0byz4a9k6sxx3m0r3szinvisfay9wlj35f";
}; };
nativeBuildInputs = [ pkgconfig ]; strictDeps = true;
buildInputs = [ python3 ];
phases = "unpackPhase installPhase"; patches = [
(substituteAll {
src = ./fix-cli-paths.patch;
inherit dropboxd;
})
];
installPhase = '' nativeBuildInputs = [
mkdir -p "$out/bin/" "$out/share/applications" pkgconfig
cp data/dropbox.desktop "$out/share/applications" gobject-introspection
cp -a data/icons "$out/share/icons" gdk_pixbuf
find "$out/share/icons" -type f \! -name '*.png' -delete # only for build, the install command also wants to use GTK through introspection
substitute "dropbox.in" "$out/bin/dropbox" \ # but we are using Nix for installation so we will not need that.
--replace '@PACKAGE_VERSION@' ${version} \ (python3.withPackages (ps: with ps; [
--replace '@DESKTOP_FILE_DIR@' "$out/share/applications" \ docutils
--replace '@IMAGEDATA16@' '"too-lazy-to-fix"' \ pygobject3
--replace '@IMAGEDATA64@' '"too-lazy-to-fix"' ]))
sed -i 's:db_path = .*:db_path = "${dropboxd}":' $out/bin/dropbox ];
chmod +x "$out/bin/"*
patchShebangs "$out/bin" buildInputs = [
''; python3
gtk3
gnome3.nautilus
];
configureFlags = [
"--with-nautilus-extension-dir=${placeholder ''nautilusExtension''}/lib/nautilus/extensions-3.0"
];
makeFlags = [
"EMBLEM_DIR=${placeholder ''nautilusExtension''}/share/nautilus-dropbox/emblems"
];
meta = { meta = {
homepage = http://dropbox.com; homepage = https://www.dropbox.com;
description = "Command line client for the dropbox daemon"; description = "Command line client for the dropbox daemon";
license = stdenv.lib.licenses.gpl3; license = stdenv.lib.licenses.gpl3Plus;
maintainers = with stdenv.lib.maintainers; [ the-kenny ]; maintainers = with stdenv.lib.maintainers; [ the-kenny ];
# NOTE: Dropbox itself only works on linux, so this is ok. # NOTE: Dropbox itself only works on linux, so this is ok.
platforms = stdenv.lib.platforms.linux; platforms = stdenv.lib.platforms.linux;

View File

@ -0,0 +1,11 @@
--- a/dropbox.in
+++ b/dropbox.in
@@ -71,7 +71,7 @@
PARENT_DIR = os.path.expanduser("~")
DROPBOX_DIST_PATH = "%s/.dropbox-dist" % PARENT_DIR
-DROPBOXD_PATH = os.path.join(DROPBOX_DIST_PATH, "dropboxd")
+DROPBOXD_PATH = "@dropboxd@"
DESKTOP_FILE = "@DESKTOP_FILE_DIR@/dropbox.desktop"
enc = locale.getpreferredencoding()