summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/mp/mpop/package.nix
blob: 011f978ac858601d053a225793f0c14bf5ffe038 (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
{
  lib,
  stdenv,
  fetchurl,
  gnutls,
  openssl,
  gsasl,
  libidn2,
  pkg-config,
  nlsSupport ? true,
  idnSupport ? true,
  gsaslSupport ? true,
  sslLibrary ? "gnutls",
}:
assert lib.assertOneOf "sslLibrary" sslLibrary [
  "gnutls"
  "openssl"
  "no"
];

stdenv.mkDerivation (finalAttrs: {
  pname = "mpop";
  version = "1.4.23";

  src = fetchurl {
    url = "https://marlam.de/mpop/releases/mpop-${finalAttrs.version}.tar.xz";
    sha256 = "sha256-Avwv9E9iuPv0J+1tixbg03R1EZglT7HmrTbrbZqTgBc=";
  };

  nativeBuildInputs = [
    pkg-config
  ];

  buildInputs =
    lib.optional gsaslSupport gsasl
    ++ lib.optional idnSupport libidn2
    ++ lib.optional (sslLibrary == "gnutls") gnutls
    ++ lib.optional (sslLibrary == "openssl") openssl;

  configureFlags = [
    (lib.enableFeature nlsSupport "nls")
    (lib.withFeature idnSupport "idn")
    (lib.withFeature gsaslSupport "gsasl")
    "--with-tls=${sslLibrary}"
  ]
  ++ lib.optional stdenv.hostPlatform.isDarwin "--with-macosx-keyring";

  meta = {
    description = "POP3 mail retrieval agent";
    homepage = "https://marlam.de/mpop";
    license = lib.licenses.gpl3Plus;
    platforms = lib.platforms.unix;
  };
})