1{ lib, stdenv
2, fetchFromGitHub
3, pkg-config
4, cmake
5, zlib
6, dbus
7, networkmanager
8, enableJavaScript ? stdenv.isDarwin || lib.meta.availableOn stdenv.hostPlatform spidermonkey_68
9, spidermonkey_68
10, pcre
11, gsettings-desktop-schemas
12, glib
13, makeWrapper
14, python3
15, SystemConfiguration
16, CoreFoundation
17, JavaScriptCore
18}:
19
20let
21 jsRuntime = if stdenv.hostPlatform.isDarwin then JavaScriptCore else spidermonkey_68;
22in stdenv.mkDerivation rec {
23 pname = "libproxy";
24 version = "0.4.17";
25
26 src = fetchFromGitHub {
27 owner = "libproxy";
28 repo = "libproxy";
29 rev = version;
30 sha256 = "0v8q4ln0pd5231kidpi8wpwh0chcjwcmawcki53czlpdrc09z96r";
31 };
32
33 outputs = [ "out" "dev" "py3" ];
34
35 nativeBuildInputs = [
36 pkg-config
37 cmake
38 makeWrapper
39 ];
40
41 buildInputs = [
42 pcre
43 python3
44 zlib
45 ] ++ lib.optionals enableJavaScript [
46 jsRuntime
47 ] ++ (if stdenv.hostPlatform.isDarwin then [
48 SystemConfiguration
49 CoreFoundation
50 ] else [
51 glib
52 dbus
53 networkmanager
54 ]);
55
56 cmakeFlags = [
57 "-DWITH_PYTHON2=OFF"
58 "-DPYTHON3_SITEPKG_DIR=${placeholder "py3"}/${python3.sitePackages}"
59 ] ++ lib.optional (enableJavaScript && !stdenv.hostPlatform.isDarwin) "-DWITH_MOZJS=ON";
60
61 postFixup = lib.optionalString stdenv.isLinux ''
62 # config_gnome3 uses the helper to find GNOME proxy settings
63 wrapProgram $out/libexec/pxgsettings --prefix XDG_DATA_DIRS : "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}"
64 '';
65
66 doCheck = false; # fails 1 out of 10 tests
67
68 meta = with lib; {
69 platforms = platforms.linux ++ platforms.darwin;
70 license = licenses.lgpl21;
71 homepage = "http://libproxy.github.io/libproxy/";
72 description = "A library that provides automatic proxy configuration management";
73 };
74}