summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorJan Tojnar <jtojnar@gmail.com>2019-05-03 01:02:23 +0200
committerGitHub <noreply@github.com>2019-05-03 01:02:23 +0200
commit00f52f0134cf2be85029ab6b658e7123ff931280 (patch)
tree2510977d8fc5aabb7af213b7ff3760de8f9db4ca /pkgs
parentea97fe2ce4ef94215a2c51dd220e0c7dd35e6b43 (diff)
parentdd0c105b87a9c4bdf670a2ac4cce4acc3ca61a42 (diff)
downloadnixpkgs-00f52f0134cf2be85029ab6b658e7123ff931280.tar
nixpkgs-00f52f0134cf2be85029ab6b658e7123ff931280.tar.gz
nixpkgs-00f52f0134cf2be85029ab6b658e7123ff931280.tar.bz2
nixpkgs-00f52f0134cf2be85029ab6b658e7123ff931280.tar.lz
nixpkgs-00f52f0134cf2be85029ab6b658e7123ff931280.tar.xz
nixpkgs-00f52f0134cf2be85029ab6b658e7123ff931280.tar.zst
nixpkgs-00f52f0134cf2be85029ab6b658e7123ff931280.zip
dropbox-cli: Fix and add Nautilus extension (#60752)
dropbox-cli: Fix and add Nautilus extension
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/applications/networking/dropbox/cli.nix72
-rw-r--r--pkgs/applications/networking/dropbox/fix-cli-paths.patch11
2 files changed, 61 insertions, 22 deletions
diff --git a/pkgs/applications/networking/dropbox/cli.nix b/pkgs/applications/networking/dropbox/cli.nix
index 73977b82047..2b6645b2c8a 100644
--- a/pkgs/applications/networking/dropbox/cli.nix
+++ b/pkgs/applications/networking/dropbox/cli.nix
@@ -1,4 +1,15 @@
-{ stdenv, pkgconfig, fetchurl, python3, dropbox }:
+{ stdenv
+, substituteAll
+, pkgconfig
+, fetchurl
+, python3
+, dropbox
+, gtk3
+, gnome3
+, gdk_pixbuf
+, gobject-introspection
+}:
+
 let
   version = "2019.02.14";
   dropboxd = "${dropbox}/bin/dropbox";
@@ -6,35 +17,52 @@ in
 stdenv.mkDerivation {
   name = "dropbox-cli-${version}";
 
+  outputs = [ "out" "nautilusExtension" ];
+
   src = fetchurl {
     url = "https://linux.dropboxstatic.com/packages/nautilus-dropbox-${version}.tar.bz2";
     sha256 = "09yg7q45sycl88l3wq0byz4a9k6sxx3m0r3szinvisfay9wlj35f";
   };
 
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [ python3 ];
-
-  phases = "unpackPhase installPhase";
-
-  installPhase = ''
-    mkdir -p "$out/bin/" "$out/share/applications"
-    cp data/dropbox.desktop "$out/share/applications"
-    cp -a data/icons "$out/share/icons"
-    find "$out/share/icons" -type f \! -name '*.png' -delete
-    substitute "dropbox.in" "$out/bin/dropbox" \
-      --replace '@PACKAGE_VERSION@' ${version} \
-      --replace '@DESKTOP_FILE_DIR@' "$out/share/applications" \
-      --replace '@IMAGEDATA16@' '"too-lazy-to-fix"' \
-      --replace '@IMAGEDATA64@' '"too-lazy-to-fix"'
-    sed -i 's:db_path = .*:db_path = "${dropboxd}":' $out/bin/dropbox
-    chmod +x "$out/bin/"*
-    patchShebangs "$out/bin"
-  '';
+  strictDeps = true;
+
+  patches = [
+    (substituteAll {
+      src = ./fix-cli-paths.patch;
+      inherit dropboxd;
+    })
+  ];
+
+  nativeBuildInputs = [
+    pkgconfig
+    gobject-introspection
+    gdk_pixbuf
+    # only for build, the install command also wants to use GTK through introspection
+    # but we are using Nix for installation so we will not need that.
+    (python3.withPackages (ps: with ps; [
+      docutils
+      pygobject3
+    ]))
+  ];
+
+  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 = {
-    homepage = http://dropbox.com;
+    homepage = https://www.dropbox.com;
     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 ];
     # NOTE: Dropbox itself only works on linux, so this is ok.
     platforms = stdenv.lib.platforms.linux;
diff --git a/pkgs/applications/networking/dropbox/fix-cli-paths.patch b/pkgs/applications/networking/dropbox/fix-cli-paths.patch
new file mode 100644
index 00000000000..84cd8014e1e
--- /dev/null
+++ b/pkgs/applications/networking/dropbox/fix-cli-paths.patch
@@ -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()