summaryrefslogtreecommitdiffstats
path: root/pkgs/applications/networking/znc/default.nix
blob: 70bccd018d80f04393e66f4bcd655537bee32099 (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
79
80
81
82
83
{
  lib,
  stdenv,
  fetchurl,
  cmake,
  openssl,
  pkg-config,
  withPerl ? false,
  perl,
  withPython ? false,
  python3,
  withTcl ? false,
  tcl,
  withCyrus ? true,
  cyrus_sasl,
  withUnicode ? true,
  icu,
  withZlib ? true,
  zlib,
  withIPv6 ? true,
  withDebug ? false,
  testers,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "znc";
  version = "1.10.2";

  src = fetchurl {
    url = "https://znc.in/releases/archive/znc-${finalAttrs.version}.tar.gz";
    hash = "sha256-W3Vh87EAI01YrklG6sAmKrMF0nXAlOZK5yPkXQe+CKs=";
  };

  postPatch = ''
    substituteInPlace znc.pc.cmake.in \
      --replace-fail 'bindir=''${exec_prefix}/@CMAKE_INSTALL_BINDIR@' "bindir=@CMAKE_INSTALL_FULL_BINDIR@" \
      --replace-fail 'libdir=''${prefix}/@CMAKE_INSTALL_LIBDIR@' "libdir=@CMAKE_INSTALL_FULL_LIBDIR@" \
      --replace-fail 'datadir=''${prefix}/@CMAKE_INSTALL_DATADIR@' "datadir=@CMAKE_INSTALL_FULL_DATADIR@" \
      --replace-fail 'includedir=''${prefix}/@CMAKE_INSTALL_INCLUDEDIR@' "includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@" \
      --replace-fail 'datarootdir=''${prefix}/@CMAKE_INSTALL_DATAROOTDIR@' "datarootdir=@CMAKE_INSTALL_FULL_DATAROOTDIR@"
  '';

  nativeBuildInputs = [
    cmake
    pkg-config
  ];

  buildInputs = [
    openssl
  ]
  ++ lib.optional withPerl perl
  ++ lib.optional withPython python3
  ++ lib.optional withTcl tcl
  ++ lib.optional withCyrus cyrus_sasl
  ++ lib.optional withUnicode icu
  ++ lib.optional withZlib zlib;

  configureFlags = [
    (lib.enableFeature withPerl "perl")
    (lib.enableFeature withPython "python")
    (lib.enableFeature withTcl "tcl")
    (lib.withFeatureAs withTcl "tcl" "${tcl}/lib")
    (lib.enableFeature withCyrus "cyrus")
  ]
  ++ lib.optionals (!withIPv6) [ "--disable-ipv6" ]
  ++ lib.optionals withDebug [ "--enable-debug" ];

  enableParallelBuilding = true;

  passthru = {
    tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
  };

  meta = {
    description = "Advanced IRC bouncer";
    homepage = "https://wiki.znc.in/ZNC";
    maintainers = [
    ];
    license = lib.licenses.asl20;
    platforms = lib.platforms.unix;
    pkgConfigModules = [ "znc" ];
  };
})