summary refs log tree commit diff
path: root/pkgs/applications/networking/p2p/twister/default.nix
blob: 30491470392ac9de4c9b8fcacbbfb49e190d8f11 (plain) (blame)
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
{ stdenv, fetchFromGitHub, fetchpatch, autoconf, automake, libtool, pkgconfig, python2
, boost, db, openssl, geoip, libiconv, miniupnpc
, srcOnly, fetchgit
}:

let
  twisterHTML = srcOnly {
    name = "twister-html";
    src = fetchgit {
      url = "git://github.com/miguelfreitas/twister-html.git";
      rev = "01e7f7ca9b7e42ed90f91bc42da2c909ca5c0b9b";
      sha256 = "0scjbin6s1kmi0bqq0dx0qyjw4n5xgmj567n0156i39f9h0dabqy";
    };
  };

  boostPython = boost.override { enablePython = true; };

in stdenv.mkDerivation rec {
  pname = "twister";
  version = "2019-08-19";

  src = fetchFromGitHub {
    owner = "miguelfreitas";
    repo = "twister-core";
    rev = "31faf3f63e461ea0a9b23081567a4a552cf06873";
    sha256 = "0xh1lgnl9nd86jr0mp7m8bkd7r5j4d6chd0y73h2xv4aq5sld0sp";
  };

  configureFlags = [
    "--with-libgeoip"
    "--with-libiconv"
    "--disable-deprecated-functions"
    "--enable-tests"
    "--enable-python-binding"
    "--with-boost-libdir=${boostPython.out}/lib"
  ];

  nativeBuildInputs = [ pkgconfig ];
  buildInputs = [
    autoconf automake libtool python2
    boostPython db openssl geoip miniupnpc libiconv
  ];

  postPatch = ''
    sed -i -e '/-htmldir/s|(default: [^)]*)|(default: ${twisterHTML})|' \
      src/init.cpp
    sed -i -e '/GetDataDir.*html/s|path *= *[^;]*|path = "${twisterHTML}"|' \
      src/util.cpp
  '';

  preConfigure = ''
    sh autotool.sh
  '';

  installPhase = ''
    install -vD twisterd "$out/bin/twisterd"
  '';

  enableParallelBuilding = true;

  meta = {
    homepage = http://www.twister.net.co/;
    description = "Peer-to-peer microblogging";
    license = stdenv.lib.licenses.mit;
    platforms = stdenv.lib.platforms.linux;
  };
}