1{
2 lib,
3 fetchFromGitHub,
4 python3,
5 asciidoc,
6 cacert,
7 docbook_xsl,
8 installShellFiles,
9 libxml2,
10 libxslt,
11 testers,
12 offlineimap,
13 fetchpatch,
14}:
15
16python3.pkgs.buildPythonApplication rec {
17 pname = "offlineimap";
18 version = "8.0.0";
19 pyproject = true;
20
21 src = fetchFromGitHub {
22 owner = "OfflineIMAP";
23 repo = "offlineimap3";
24 rev = "v${version}";
25 hash = "sha256-XLxKqO5OCXsFu8S3lMp2Ke5hp6uer9npZ3ujmL6Kb3g=";
26 };
27
28 patches = [
29 (fetchpatch {
30 name = "sqlite-version-aware-threadsafety-check.patch";
31 url = "https://github.com/OfflineIMAP/offlineimap3/pull/139/commits/7cd32cf834b34a3d4675b29bebcd32dc1e5ef128.patch";
32 hash = "sha256-xNq4jFHMf9XZaa9BFF1lOzZrEGa5BEU8Dr+gMOBkJE4=";
33 })
34 (fetchpatch {
35 # https://github.com/OfflineIMAP/offlineimap3/pull/120
36 name = "python312-comaptibility.patch";
37 url = "https://github.com/OfflineIMAP/offlineimap3/commit/a1951559299b297492b8454850fcfe6eb9822a38.patch";
38 hash = "sha256-CBGMHi+ZzOBJt3TxBf6elrTRMIQ+8wr3JgptL2etkoA=";
39 })
40 (fetchpatch {
41 # https://github.com/OfflineIMAP/offlineimap3/pull/161
42 name = "python312-compatibility.patch";
43 url = "https://github.com/OfflineIMAP/offlineimap3/commit/3dd8ebc931e3f3716a90072bd34e50ac1df629fa.patch";
44 hash = "sha256-2IJ0yzESt+zk+r+Z+9js3oKhFF0+xok0xK8Jd3G/gYY=";
45 })
46 ];
47
48 postPatch = ''
49 # Skip xmllint to stop failures due to no network access
50 sed -i docs/Makefile -e "s|a2x -v -d |a2x -L -v -d |"
51
52 # Provide CA certificates (Used when "sslcacertfile = OS-DEFAULT" is configured")
53 sed -i offlineimap/utils/distro_utils.py -e '/def get_os_sslcertfile():/a\ \ \ \ return "${cacert}/etc/ssl/certs/ca-bundle.crt"'
54 '';
55
56 build-system = [ python3.pkgs.setuptools ];
57
58 nativeBuildInputs = [
59 asciidoc
60 docbook_xsl
61 installShellFiles
62 libxml2
63 libxslt
64 ];
65
66 dependencies = with python3.pkgs; [
67 certifi
68 distro
69 imaplib2
70 pysocks
71 rfc6555
72 urllib3
73 ];
74
75 postInstall = ''
76 make -C docs man
77 installManPage docs/offlineimap.1
78 installManPage docs/offlineimapui.7
79 '';
80
81 # Test requires credentials
82 doCheck = false;
83
84 pythonImportsCheck = [
85 "offlineimap"
86 ];
87
88 passthru.tests.version = testers.testVersion { package = offlineimap; };
89
90 meta = with lib; {
91 description = "Synchronize emails between two repositories, so that you can read the same mailbox from multiple computers";
92 homepage = "http://offlineimap.org";
93 license = licenses.gpl2Plus;
94 maintainers = [ ];
95 mainProgram = "offlineimap";
96 };
97}