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