1{ lib, stdenv
2, substituteAll
3, autoreconfHook
4, pkg-config
5, fetchurl
6, python3
7, dropbox
8, gtk4
9, gnome
10, gdk-pixbuf
11, gobject-introspection
12}:
13
14let
15 version = "2023.09.06";
16 dropboxd = "${dropbox}/bin/dropbox";
17in
18stdenv.mkDerivation {
19 pname = "dropbox-cli";
20 inherit version;
21
22 outputs = [ "out" "nautilusExtension" ];
23
24 src = fetchurl {
25 url = "https://linux.dropbox.com/packages/nautilus-dropbox-${version}.tar.bz2";
26 hash = "sha256-kZMwj8Fn8Hf58C57wE025TlmiSs5TaKMGEzvb2QjgSw=";
27 };
28
29 strictDeps = true;
30
31 patches = [
32 (substituteAll {
33 src = ./fix-cli-paths.patch;
34 inherit dropboxd;
35 })
36 ];
37
38 nativeBuildInputs = [
39 autoreconfHook
40 pkg-config
41 gobject-introspection
42 gdk-pixbuf
43 # only for build, the install command also wants to use GTK through introspection
44 # but we are using Nix for installation so we will not need that.
45 (python3.withPackages (ps: with ps; [
46 docutils
47 pygobject3
48 ]))
49 ];
50
51 buildInputs = [
52 python3
53 gtk4
54 gnome.nautilus
55 ];
56
57 configureFlags = [
58 "--with-nautilus-extension-dir=${placeholder "nautilusExtension"}/lib/nautilus/extension-4"
59 ];
60
61 makeFlags = [
62 "EMBLEM_DIR=${placeholder "nautilusExtension"}/share/nautilus-dropbox/emblems"
63 ];
64
65 meta = {
66 homepage = "https://www.dropbox.com";
67 description = "Command line client for the dropbox daemon";
68 license = lib.licenses.gpl3Plus;
69 mainProgram = "dropbox";
70 maintainers = with lib.maintainers; [ eclairevoyant ];
71 # NOTE: Dropbox itself only works on linux, so this is ok.
72 platforms = lib.platforms.linux;
73 };
74}