1 { lib, stdenv, fetchFromGitHub, cmake
2 , libsodium, mbedtls_2, libev, c-ares, pcre
3 , asciidoc, xmlto, docbook_xml_dtd_45, docbook_xsl, libxslt
6 stdenv.mkDerivation rec {
7 pname = "shadowsocks-libev";
10 # Git tag includes CMake build files which are much more convenient.
11 src = fetchFromGitHub {
12 owner = "shadowsocks";
14 rev = "refs/tags/v${version}";
15 sha256 = "1iqpmhxk354db1x08axg6wrdy9p9a4mz0h9351i3mf3pqd1v6fdw";
16 fetchSubmodules = true;
19 buildInputs = [ libsodium mbedtls_2 libev c-ares pcre ];
20 nativeBuildInputs = [ cmake asciidoc xmlto docbook_xml_dtd_45
21 docbook_xsl libxslt ];
23 cmakeFlags = [ "-DWITH_STATIC=OFF" "-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON"
24 # RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
25 "-DCMAKE_SKIP_BUILD_RPATH=ON"
29 # https://github.com/shadowsocks/shadowsocks-libev/issues/2901
30 substituteInPlace CMakeLists.txt \
31 --replace '# pkg-config' \
33 include(GNUInstallDirs)'
34 substituteInPlace cmake/shadowsocks-libev.pc.cmake \
35 --replace @prefix@ @CMAKE_INSTALL_PREFIX@ \
36 --replace '$'{prefix}/@CMAKE_INSTALL_BINDIR@ @CMAKE_INSTALL_FULL_BINDIR@ \
37 --replace '$'{exec_prefix}/@CMAKE_INSTALL_FULL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
38 --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@ \
39 --replace '$'{prefix}/@CMAKE_INSTALL_DATAROOTDIR@ @CMAKE_INSTALL_FULL_DATAROOTDIR@ \
40 --replace '$'{prefix}/@CMAKE_INSTALL_MANDIR@ @CMAKE_INSTALL_FULL_MANDIR@
42 # https://github.com/dcreager/libcork/issues/173 but needs a different patch (yay vendoring)
43 substituteInPlace libcork/src/libcork.pc.in \
44 --replace '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
45 --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
53 description = "Lightweight secured SOCKS5 proxy";
55 Shadowsocks-libev is a lightweight secured SOCKS5 proxy for embedded devices and low-end boxes.
56 It is a port of Shadowsocks created by @clowwindy, which is maintained by @madeye and @linusyang.
58 homepage = "https://github.com/shadowsocks/shadowsocks-libev";
59 license = licenses.gpl3Plus;
61 platforms = platforms.all;