1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 buildPythonPackage,
6 rustPlatform,
7 cargo,
8 pkg-config,
9 rustc,
10 rustfmt,
11 setuptools-rust,
12 openssl,
13 Security,
14 msgpack,
15 fetchpatch,
16 nixosTests,
17}:
18
19buildPythonPackage rec {
20 pname = "etebase";
21 version = "0.31.7";
22
23 src = fetchFromGitHub {
24 owner = "etesync";
25 repo = "etebase-py";
26 rev = "v${version}";
27 hash = "sha256-ZNUUp/0fGJxL/Rt8sAZ864rg8uCcNybIYSk4POt0vqg=";
28 };
29
30 # https://github.com/etesync/etebase-py/pull/54
31 patches = [
32 # fix python 3.12 build
33 (fetchpatch {
34 url = "https://github.com/etesync/etebase-py/commit/898eb3aca1d4eb30d4aeae15e35d0bc45dd7b3c8.patch";
35 hash = "sha256-0BDUTztiC4MiwwNEDFtfc5ruc69Qk+svepQZRixNJgA=";
36 })
37 # replace flapigen git dependency in Cargo.lock
38 (fetchpatch {
39 url = "https://github.com/etesync/etebase-py/commit/7e9e4244a144dd46383d8be950d3df79e28eb069.patch";
40 hash = "sha256-8EH8Sc3UnmuCrSwDf3+as218HiG2Ed3r+FCMrUi5YrI=";
41 })
42 ];
43
44 cargoDeps = rustPlatform.fetchCargoTarball {
45 inherit src;
46 name = "${pname}-${version}";
47 hash = "sha256-We19laZd6b2fLSPNLegyNp0eQSeCvUJeTIXqvG7o08c=";
48 inherit patches;
49 };
50
51 format = "pyproject";
52
53 nativeBuildInputs = [
54 pkg-config
55 rustfmt
56 setuptools-rust
57 rustPlatform.cargoSetupHook
58 cargo
59 rustc
60 ];
61
62 buildInputs = [ openssl ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ Security ];
63
64 propagatedBuildInputs = [ msgpack ];
65
66 postPatch = ''
67 # Use system OpenSSL, which gets security updates.
68 substituteInPlace Cargo.toml \
69 --replace ', features = ["vendored"]' ""
70 '';
71
72 pythonImportsCheck = [ "etebase" ];
73
74 passthru.tests = {
75 inherit (nixosTests) etebase-server;
76 };
77
78 meta = with lib; {
79 broken = stdenv.hostPlatform.isDarwin;
80 homepage = "https://www.etebase.com/";
81 description = "Python client library for Etebase";
82 license = licenses.bsd3;
83 maintainers = with maintainers; [ _3699n ];
84 };
85}