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 src;
44 name = "${pname}-${version}";
45 hash = "sha256-tFOZJFrNge3N+ux2Hp4Mlm9K/AXYxuuBzEQdQYGGDjg=";
46 inherit patches;
47 };
48
49 format = "pyproject";
50
51 nativeBuildInputs = [
52 pkg-config
53 rustfmt
54 setuptools-rust
55 rustPlatform.cargoSetupHook
56 cargo
57 rustc
58 ];
59
60 buildInputs = [ openssl ];
61
62 propagatedBuildInputs = [ msgpack ];
63
64 postPatch = ''
65 # Use system OpenSSL, which gets security updates.
66 substituteInPlace Cargo.toml \
67 --replace ', features = ["vendored"]' ""
68 '';
69
70 pythonImportsCheck = [ "etebase" ];
71
72 passthru.tests = {
73 inherit (nixosTests) etebase-server;
74 };
75
76 meta = with lib; {
77 homepage = "https://www.etebase.com/";
78 description = "Python client library for Etebase";
79 license = licenses.bsd3;
80 maintainers = with maintainers; [ _3699n ];
81 };
82}