summaryrefslogtreecommitdiff
path: root/pkgs/tools/networking/isync/default.nix
blob: 017e6dd96ada6b0e75f9a194d101891f5323d69e (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
{
  lib,
  stdenv,
  fetchgit,
  pkg-config,
  perl,
  openssl,
  db,
  cyrus_sasl,
  zlib,
  perl538Packages,
  autoreconfHook,
  Security,
  # Disabled by default as XOAUTH2 is an "OBSOLETE" SASL mechanism and this relies
  # on a package that isn't really maintained anymore:
  withCyrusSaslXoauth2 ? false,
  cyrus-sasl-xoauth2,
  makeWrapper,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "isync";
  version = "1.5.1";

  src = fetchgit {
    url = "https://git.code.sf.net/p/isync/isync";
    tag = "v${finalAttrs.version}";
    hash = "sha256-l0jL4CzAdFtQGekbywic1Kuihy3ZQi4ozhSEcbJI0t0=";
  };

  # Fixes "Fatal: buffer too small" error
  # see https://sourceforge.net/p/isync/mailman/isync-devel/thread/87fsevvebj.fsf%40steelpick.2x.cz/
  env.NIX_CFLAGS_COMPILE = "-DQPRINTF_BUFF=4000";

  autoreconfPhase = ''
    echo "${finalAttrs.version}" > VERSION
    ./autogen.sh
  '';

  nativeBuildInputs = [
    autoreconfHook
    pkg-config
    perl
  ] ++ lib.optionals withCyrusSaslXoauth2 [ makeWrapper ];
  buildInputs = [
    perl538Packages.TimeDate
    openssl
    db
    cyrus_sasl
    zlib
  ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ Security ];

  postInstall = lib.optionalString withCyrusSaslXoauth2 ''
    wrapProgram "$out/bin/mbsync" \
        --prefix SASL_PATH : "${
          lib.makeSearchPath "lib/sasl2" [
            cyrus-sasl-xoauth2
            cyrus_sasl.out
          ]
        }"
  '';

  meta = {
    homepage = "http://isync.sourceforge.net/";
    # https://sourceforge.net/projects/isync/
    changelog = "https://sourceforge.net/p/isync/isync/ci/v${finalAttrs.version}/tree/NEWS";
    description = "Free IMAP and MailDir mailbox synchronizer";
    longDescription = ''
      mbsync (formerly isync) is a command line application which synchronizes
      mailboxes. Currently Maildir and IMAP4 mailboxes are supported. New
      messages, message deletions and flag changes can be propagated both ways.
    '';
    license = lib.licenses.gpl2Plus;
    platforms = lib.platforms.unix;
    maintainers = with lib.maintainers; [ primeos ];
    mainProgram = "mbsync";
  };
})