nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 cmake,
6 libsodium,
7 mbedtls_2,
8 libev,
9 c-ares,
10 pcre,
11 asciidoc,
12 xmlto,
13 docbook_xml_dtd_45,
14 docbook_xsl,
15 libxslt,
16}:
17
18stdenv.mkDerivation rec {
19 pname = "shadowsocks-libev";
20 version = "3.3.5";
21
22 # Git tag includes CMake build files which are much more convenient.
23 src = fetchFromGitHub {
24 owner = "shadowsocks";
25 repo = "shadowsocks-libev";
26 tag = "v${version}";
27 sha256 = "1iqpmhxk354db1x08axg6wrdy9p9a4mz0h9351i3mf3pqd1v6fdw";
28 fetchSubmodules = true;
29 };
30
31 buildInputs = [
32 libsodium
33 mbedtls_2
34 libev
35 c-ares
36 pcre
37 ];
38 nativeBuildInputs = [
39 cmake
40 asciidoc
41 xmlto
42 docbook_xml_dtd_45
43 docbook_xsl
44 libxslt
45 ];
46
47 cmakeFlags = [
48 "-DWITH_STATIC=OFF"
49 "-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON"
50 # RPATH of binary /nix/store/.../bin/... contains a forbidden reference to /build/
51 "-DCMAKE_SKIP_BUILD_RPATH=ON"
52 ];
53
54 postPatch = ''
55 # https://github.com/shadowsocks/shadowsocks-libev/issues/2901
56 substituteInPlace CMakeLists.txt \
57 --replace '# pkg-config' \
58 '# pkg-config
59 include(GNUInstallDirs)'
60 substituteInPlace cmake/shadowsocks-libev.pc.cmake \
61 --replace @prefix@ @CMAKE_INSTALL_PREFIX@ \
62 --replace '$'{prefix}/@CMAKE_INSTALL_BINDIR@ @CMAKE_INSTALL_FULL_BINDIR@ \
63 --replace '$'{exec_prefix}/@CMAKE_INSTALL_FULL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
64 --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@ \
65 --replace '$'{prefix}/@CMAKE_INSTALL_DATAROOTDIR@ @CMAKE_INSTALL_FULL_DATAROOTDIR@ \
66 --replace '$'{prefix}/@CMAKE_INSTALL_MANDIR@ @CMAKE_INSTALL_FULL_MANDIR@
67
68 # https://github.com/dcreager/libcork/issues/173 but needs a different patch (yay vendoring)
69 substituteInPlace libcork/src/libcork.pc.in \
70 --replace '$'{exec_prefix}/@CMAKE_INSTALL_LIBDIR@ @CMAKE_INSTALL_FULL_LIBDIR@ \
71 --replace '$'{prefix}/@CMAKE_INSTALL_INCLUDEDIR@ @CMAKE_INSTALL_FULL_INCLUDEDIR@
72 '';
73
74 postInstall = ''
75 cp lib/* $out/lib
76 '';
77
78 meta = with lib; {
79 description = "Lightweight secured SOCKS5 proxy";
80 longDescription = ''
81 Shadowsocks-libev is a lightweight secured SOCKS5 proxy for embedded devices and low-end boxes.
82 It is a port of Shadowsocks created by @clowwindy, which is maintained by @madeye and @linusyang.
83 '';
84 homepage = "https://github.com/shadowsocks/shadowsocks-libev";
85 license = licenses.gpl3Plus;
86 maintainers = [ ];
87 platforms = platforms.all;
88 };
89}