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