1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 makePythonPath,
7 pythonOlder,
8 python,
9 click,
10 dbus-python,
11 desktop-notifier,
12 dropbox,
13 fasteners,
14 importlib-metadata,
15 keyring,
16 keyrings-alt,
17 packaging,
18 pathspec,
19 pyro5,
20 requests,
21 rich,
22 rubicon-objc,
23 setuptools,
24 survey,
25 typing-extensions,
26 watchdog,
27 xattr,
28 fetchpatch,
29 pytestCheckHook,
30 nixosTests,
31}:
32
33buildPythonPackage rec {
34 pname = "maestral";
35 version = "1.9.3";
36 pyproject = true;
37
38 disabled = pythonOlder "3.8";
39
40 src = fetchFromGitHub {
41 owner = "SamSchott";
42 repo = "maestral";
43 rev = "refs/tags/v${version}";
44 hash = "sha256-h7RDaCVICi3wl6/b1s01cINhFirDOpOXoxTPZIBH3jE=";
45 };
46
47 build-system = [ setuptools ];
48
49 dependencies = [
50 click
51 desktop-notifier
52 dbus-python
53 dropbox
54 fasteners
55 importlib-metadata
56 keyring
57 keyrings-alt
58 packaging
59 pathspec
60 pyro5
61 requests
62 rich
63 setuptools
64 survey
65 typing-extensions
66 watchdog
67 xattr
68 ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ rubicon-objc ];
69
70 patches = [
71 (fetchpatch {
72 name = "upgrade-dropbox-version-bounds";
73 url = "https://github.com/samschott/maestral/commit/8fd581fa503391534913afbc33a61132ff2e21ce.patch";
74 hash = "sha256-2Dke9iF/5Ptsf3CSRHUkjdFRrmdKY+L3sILRMyYrUH0=";
75 })
76 ];
77
78 makeWrapperArgs = [
79 # Add the installed directories to the python path so the daemon can find them
80 "--prefix PYTHONPATH : ${makePythonPath dependencies}"
81 "--prefix PYTHONPATH : $out/${python.sitePackages}"
82 ];
83
84 nativeCheckInputs = [ pytestCheckHook ];
85
86 # ModuleNotFoundError: No module named '_watchdog_fsevents'
87 doCheck = !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64);
88
89 preCheck = ''
90 export HOME=$(mktemp -d)
91 '';
92
93 disabledTests =
94 [
95 # We don't want to benchmark
96 "test_performance"
97 # Requires systemd
98 "test_autostart"
99 # Requires network access
100 "test_check_for_updates"
101 # Tries to look at /usr
102 "test_filestatus"
103 "test_path_exists_case_insensitive"
104 "test_cased_path_candidates"
105 # AssertionError
106 "test_locking_multiprocess"
107 # OSError: [Errno 95] Operation not supported
108 "test_move_preserves_xattrs"
109 ]
110 ++ lib.optionals stdenv.hostPlatform.isDarwin [
111 # maetral daemon does not start but worked in real environment
112 "test_catching_non_ignored_events"
113 "test_connection"
114 "test_event_handler"
115 "test_fs_ignore_tree_creation"
116 "test_lifecycle"
117 "test_notify_level"
118 "test_notify_snooze"
119 "test_receiving_events"
120 "test_remote_exceptions"
121 "test_start_already_running"
122 "test_stop"
123 ];
124
125 pythonImportsCheck = [ "maestral" ];
126
127 passthru.tests.maestral = nixosTests.maestral;
128
129 meta = with lib; {
130 description = "Open-source Dropbox client for macOS and Linux";
131 mainProgram = "maestral";
132 homepage = "https://maestral.app";
133 changelog = "https://github.com/samschott/maestral/releases/tag/v${version}";
134 license = licenses.mit;
135 maintainers = with maintainers; [
136 natsukium
137 peterhoeg
138 sfrijters
139 ];
140 };
141}