diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 8ee4dfbf13bc..6964d5261fc4 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -95,6 +95,7 @@ in gitlab = handleTest ./gitlab.nix {}; gitolite = handleTest ./gitolite.nix {}; gjs = handleTest ./gjs.nix {}; + glib-networking = handleTest ./glib-networking.nix {}; glusterfs = handleTest ./glusterfs.nix {}; gnome3-xorg = handleTest ./gnome3-xorg.nix {}; gnome3 = handleTest ./gnome3.nix {}; diff --git a/nixos/tests/glib-networking.nix b/nixos/tests/glib-networking.nix new file mode 100644 index 000000000000..c0bbb2b3554b --- /dev/null +++ b/nixos/tests/glib-networking.nix @@ -0,0 +1,17 @@ +# run installed tests +import ./make-test.nix ({ pkgs, ... }: + +{ + name = "glib-networking"; + meta = { + maintainers = pkgs.glib-networking.meta.maintainers; + }; + + machine = { pkgs, ... }: { + environment.systemPackages = with pkgs; [ gnome-desktop-testing ]; + }; + + testScript = '' + $machine->succeed("gnome-desktop-testing-runner -d '${pkgs.glib-networking.installedTests}/share'"); + ''; +}) diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix index 4f853e9821ff..ae386f46bffc 100644 --- a/pkgs/development/libraries/glib-networking/default.nix +++ b/pkgs/development/libraries/glib-networking/default.nix @@ -1,21 +1,40 @@ -{ stdenv, fetchurl, meson, ninja, pkgconfig, glib, gettext, python3, gnutls, p11-kit, libproxy, gnome3 -, gsettings-desktop-schemas }: +{ stdenv +, fetchurl +, substituteAll +, meson +, ninja +, nixosTests +, pkgconfig +, glib +, gettext +, makeWrapper +, python3 +, gnutls +, p11-kit +, libproxy +, gnome3 +, gsettings-desktop-schemas +}: -let +stdenv.mkDerivation rec { pname = "glib-networking"; version = "2.60.3"; -in -stdenv.mkDerivation rec { - name = "${pname}-${version}"; + + outputs = [ "out" "installedTests" ]; src = fetchurl { - url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${name}.tar.xz"; + url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; sha256 = "1mfw44qpmwvz6yzj8c6spx6z357wrmkk15byrkc5byagd82860fm"; }; - outputs = [ "out" "dev" ]; # to deal with propagatedBuildInputs + patches = [ + (substituteAll { + src = ./hardcode-gsettings.patch; + gds_gsettings_path = glib.getSchemaPath gsettings-desktop-schemas; + }) - PKG_CONFIG_GIO_2_0_GIOMODULEDIR = "${placeholder "out"}/lib/gio/modules"; + ./installed-tests-path.patch + ]; postPatch = '' chmod +x meson_post_install.py # patchShebangs requires executable file @@ -23,27 +42,52 @@ stdenv.mkDerivation rec { ''; nativeBuildInputs = [ - meson ninja pkgconfig gettext - python3 # install_script + meson + ninja + pkgconfig + gettext + makeWrapper + python3 # for install_script ]; - propagatedBuildInputs = [ glib gnutls p11-kit libproxy gsettings-desktop-schemas ]; - mesonFlags = [ - # Default auto detection doesn't work - "-Dgnutls=enabled" + buildInputs = [ + glib + gnutls + p11-kit + libproxy + gsettings-desktop-schemas ]; doCheck = false; # tests need to access the certificates (among other things) + mesonFlags = [ + "-Dinstalled_tests=true" + "-Dinstalled_test_prefix=${placeholder "installedTests"}" + ]; + + postFixup = '' + find "$installedTests/libexec" "$out/libexec" -type f -executable -print0 \ + | while IFS= read -r -d "" file; do + echo "Wrapping program '$file'" + wrapProgram "$file" --prefix GIO_EXTRA_MODULES : "$out/lib/gio/modules" + done + ''; + passthru = { updateScript = gnome3.updateScript { packageName = pname; }; + + tests = { + installedTests = nixosTests.glib-networking; + }; }; meta = with stdenv.lib; { description = "Network-related giomodules for glib"; - license = licenses.lgpl2Plus; + homepage = https://gitlab.gnome.org/GNOME/glib-networking; + license = licenses.lgpl21Plus; + maintainers = gnome3.maintainers; platforms = platforms.unix; }; } diff --git a/pkgs/development/libraries/glib-networking/hardcode-gsettings.patch b/pkgs/development/libraries/glib-networking/hardcode-gsettings.patch new file mode 100644 index 000000000000..0a091b2344dc --- /dev/null +++ b/pkgs/development/libraries/glib-networking/hardcode-gsettings.patch @@ -0,0 +1,341 @@ +diff --git a/proxy/gnome/gproxyresolvergnome.c b/proxy/gnome/gproxyresolvergnome.c +index 50b63cd..4364116 100644 +--- a/proxy/gnome/gproxyresolvergnome.c ++++ b/proxy/gnome/gproxyresolvergnome.c +@@ -156,23 +156,79 @@ + + resolver->base_resolver = g_simple_proxy_resolver_new (NULL, NULL); + +- resolver->proxy_settings = g_settings_new (GNOME_PROXY_SETTINGS_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA, ++ FALSE); ++ resolver->proxy_settings = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_signal_connect (resolver->proxy_settings, "changed", + G_CALLBACK (gsettings_changed), resolver); +- resolver->http_settings = g_settings_get_child (resolver->proxy_settings, +- GNOME_PROXY_HTTP_CHILD_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_HTTP_CHILD_SCHEMA, ++ FALSE); ++ resolver->http_settings = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_signal_connect (resolver->http_settings, "changed", + G_CALLBACK (gsettings_changed), resolver); +- resolver->https_settings = g_settings_get_child (resolver->proxy_settings, +- GNOME_PROXY_HTTPS_CHILD_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_HTTPS_CHILD_SCHEMA, ++ FALSE); ++ resolver->https_settings = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_signal_connect (resolver->https_settings, "changed", + G_CALLBACK (gsettings_changed), resolver); +- resolver->ftp_settings = g_settings_get_child (resolver->proxy_settings, +- GNOME_PROXY_FTP_CHILD_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_FTP_CHILD_SCHEMA, ++ FALSE); ++ resolver->ftp_settings = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_signal_connect (resolver->ftp_settings, "changed", + G_CALLBACK (gsettings_changed), resolver); +- resolver->socks_settings = g_settings_get_child (resolver->proxy_settings, +- GNOME_PROXY_SOCKS_CHILD_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_SOCKS_CHILD_SCHEMA, ++ FALSE); ++ resolver->socks_settings = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_signal_connect (resolver->socks_settings, "changed", + G_CALLBACK (gsettings_changed), resolver); + +diff --git a/proxy/tests/gnome.c b/proxy/tests/gnome.c +index f76b094..54751e3 100644 +--- a/proxy/tests/gnome.c ++++ b/proxy/tests/gnome.c +@@ -55,26 +55,86 @@ + { + GSettings *settings, *child; + +- settings = g_settings_new (GNOME_PROXY_SETTINGS_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA, ++ FALSE); ++ settings = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_settings_reset (settings, GNOME_PROXY_MODE_KEY); + g_settings_reset (settings, GNOME_PROXY_USE_SAME_PROXY_KEY); + +- child = g_settings_get_child (settings, GNOME_PROXY_HTTP_CHILD_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_HTTP_CHILD_SCHEMA, ++ FALSE); ++ child = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_settings_reset (child, GNOME_PROXY_HTTP_HOST_KEY); + g_settings_reset (child, GNOME_PROXY_HTTP_PORT_KEY); + g_object_unref (child); + +- child = g_settings_get_child (settings, GNOME_PROXY_HTTPS_CHILD_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_HTTPS_CHILD_SCHEMA, ++ FALSE); ++ child = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_settings_reset (child, GNOME_PROXY_HTTPS_HOST_KEY); + g_settings_reset (child, GNOME_PROXY_HTTPS_PORT_KEY); + g_object_unref (child); + +- child = g_settings_get_child (settings, GNOME_PROXY_FTP_CHILD_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_FTP_CHILD_SCHEMA, ++ FALSE); ++ child = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_settings_reset (child, GNOME_PROXY_FTP_HOST_KEY); + g_settings_reset (child, GNOME_PROXY_FTP_PORT_KEY); + g_object_unref (child); + +- child = g_settings_get_child (settings, GNOME_PROXY_SOCKS_CHILD_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_SOCKS_CHILD_SCHEMA, ++ FALSE); ++ child = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_settings_reset (child, GNOME_PROXY_SOCKS_HOST_KEY); + g_settings_reset (child, GNOME_PROXY_SOCKS_PORT_KEY); + g_object_unref (child); +@@ -88,21 +148,69 @@ + { + GSettings *settings, *child; + +- settings = g_settings_new (GNOME_PROXY_SETTINGS_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA, ++ FALSE); ++ settings = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_settings_set_enum (settings, GNOME_PROXY_MODE_KEY, G_DESKTOP_PROXY_MODE_MANUAL); + g_settings_set_boolean (settings, GNOME_PROXY_USE_SAME_PROXY_KEY, TRUE); + +- child = g_settings_get_child (settings, GNOME_PROXY_HTTP_CHILD_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_HTTP_CHILD_SCHEMA, ++ FALSE); ++ child = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_settings_set_string (child, GNOME_PROXY_HTTP_HOST_KEY, "proxy.example.com"); + g_settings_set_int (child, GNOME_PROXY_HTTP_PORT_KEY, 8080); + g_object_unref (child); + +- child = g_settings_get_child (settings, GNOME_PROXY_HTTPS_CHILD_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_HTTPS_CHILD_SCHEMA, ++ FALSE); ++ child = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_settings_set_string (child, GNOME_PROXY_HTTPS_HOST_KEY, "proxy-s.example.com"); + g_settings_set_int (child, GNOME_PROXY_HTTPS_PORT_KEY, 7070); + g_object_unref (child); + +- child = g_settings_get_child (settings, GNOME_PROXY_FTP_CHILD_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_FTP_CHILD_SCHEMA, ++ FALSE); ++ child = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_settings_set_string (child, GNOME_PROXY_FTP_HOST_KEY, "proxy-f.example.com"); + g_settings_set_int (child, GNOME_PROXY_FTP_PORT_KEY, 6060); + g_object_unref (child); +@@ -119,12 +227,36 @@ + GSettings *settings, *child; + const gchar *ignore_hosts[2] = { "127.0.0.1", NULL }; + +- settings = g_settings_new (GNOME_PROXY_SETTINGS_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA, ++ FALSE); ++ settings = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_settings_set_enum (settings, GNOME_PROXY_MODE_KEY, G_DESKTOP_PROXY_MODE_MANUAL); + g_settings_set (settings, GNOME_PROXY_IGNORE_HOSTS_KEY, + "@as", g_variant_new_strv (ignore_hosts, -1)); + +- child = g_settings_get_child (settings, GNOME_PROXY_SOCKS_CHILD_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_SOCKS_CHILD_SCHEMA, ++ FALSE); ++ child = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_settings_set_string (child, GNOME_PROXY_SOCKS_HOST_KEY, "proxy.example.com"); + g_settings_set_int (child, GNOME_PROXY_SOCKS_PORT_KEY, 1234); + g_object_unref (child); +@@ -139,12 +271,36 @@ + { + GSettings *settings, *http; + +- settings = g_settings_new (GNOME_PROXY_SETTINGS_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA, ++ FALSE); ++ settings = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_settings_set_enum (settings, GNOME_PROXY_MODE_KEY, G_DESKTOP_PROXY_MODE_MANUAL); + g_settings_set (settings, GNOME_PROXY_IGNORE_HOSTS_KEY, + "@as", g_variant_new_strv (ignore_hosts, n_ignore_hosts)); + +- http = g_settings_get_child (settings, GNOME_PROXY_HTTP_CHILD_SCHEMA); ++ { ++ GSettingsSchemaSource *schema_source; ++ GSettingsSchema *schema; ++ schema_source = g_settings_schema_source_new_from_directory("@gds_gsettings_path@", ++ g_settings_schema_source_get_default(), ++ TRUE, NULL); ++ schema = g_settings_schema_source_lookup(schema_source, ++ GNOME_PROXY_SETTINGS_SCHEMA "." GNOME_PROXY_HTTP_CHILD_SCHEMA, ++ FALSE); ++ http = g_settings_new_full(schema, NULL, NULL); ++ g_settings_schema_source_unref(schema_source); ++ g_settings_schema_unref(schema); ++ } + g_settings_set_string (http, GNOME_PROXY_HTTP_HOST_KEY, "localhost"); + g_settings_set_int (http, GNOME_PROXY_HTTP_PORT_KEY, 8080); + diff --git a/pkgs/development/libraries/glib-networking/installed-tests-path.patch b/pkgs/development/libraries/glib-networking/installed-tests-path.patch new file mode 100644 index 000000000000..942ca053dd4f --- /dev/null +++ b/pkgs/development/libraries/glib-networking/installed-tests-path.patch @@ -0,0 +1,25 @@ +diff --git a/meson.build b/meson.build +index 4d91677..aaaeb2b 100644 +--- a/meson.build ++++ b/meson.build +@@ -12,8 +12,8 @@ + libexecdir = join_paths(prefix, get_option('libexecdir')) + localedir = join_paths(prefix, get_option('localedir')) + +-installed_tests_metadir = join_paths(datadir, 'installed-tests', meson.project_name()) +-installed_tests_execdir = join_paths(libexecdir, 'installed-tests', meson.project_name()) ++installed_tests_metadir = join_paths(get_option('installed_test_prefix'), 'share', 'installed-tests', meson.project_name()) ++installed_tests_execdir = join_paths(get_option('installed_test_prefix'), 'libexec', 'installed-tests', meson.project_name()) + + cc = meson.get_compiler('c') + host_system = host_machine.system() +diff --git a/meson_options.txt b/meson_options.txt +index 3a525dd..fc86302 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -3,4 +3,5 @@ + option('libproxy', type: 'feature', value: 'auto', description: 'support for libproxy proxy configration') + option('gnome_proxy', type: 'feature', value: 'auto', description: 'support for GNOME desktop proxy configuration') + option('installed_tests', type: 'boolean', value: false, description: 'enable installed tests') ++option('installed_test_prefix', type: 'string', value: '', description: 'Prefix for installed tests') + option('static_modules', type: 'boolean', value: false, description: 'build static modules') diff --git a/pkgs/development/libraries/libproxy/default.nix b/pkgs/development/libraries/libproxy/default.nix index 09bb0e4aa3f2..844d626f49e3 100644 --- a/pkgs/development/libraries/libproxy/default.nix +++ b/pkgs/development/libraries/libproxy/default.nix @@ -1,6 +1,22 @@ -{ stdenv, fetchFromGitHub, pkgconfig, cmake, zlib, fetchpatch -, dbus, networkmanager, spidermonkey_38, pcre, python2, python3 -, SystemConfiguration, CoreFoundation, JavaScriptCore }: +{ stdenv +, fetchFromGitHub +, pkgconfig +, cmake +, zlib +, fetchpatch +, dbus +, networkmanager +, spidermonkey_38 +, pcre +, gsettings-desktop-schemas +, glib +, makeWrapper +, python2 +, python3 +, SystemConfiguration +, CoreFoundation +, JavaScriptCore +}: stdenv.mkDerivation rec { pname = "libproxy"; @@ -13,28 +29,47 @@ stdenv.mkDerivation rec { sha256 = "10swd3x576pinx33iwsbd4h15fbh2snmfxzcmab4c56nb08qlbrs"; }; - outputs = [ "out" "dev" ]; # to deal with propagatedBuildInputs + outputs = [ "out" "dev" "py2" "py3" ]; - nativeBuildInputs = [ pkgconfig cmake ]; + nativeBuildInputs = [ + pkgconfig + cmake + makeWrapper + ]; - buildInputs = [ pcre python2 python3 zlib ] - ++ (if stdenv.hostPlatform.isDarwin - then [ SystemConfiguration CoreFoundation JavaScriptCore ] - else [ spidermonkey_38 dbus networkmanager ]); + buildInputs = [ + pcre + python2 + python3 + zlib + ] ++ (if stdenv.hostPlatform.isDarwin then [ + SystemConfiguration + CoreFoundation + JavaScriptCore + ] else [ + glib + spidermonkey_38 + dbus + networkmanager + ]); - preConfigure = '' - cmakeFlagsArray+=( - "-DWITH_MOZJS=ON" - "-DPYTHON2_SITEPKG_DIR=$out/${python2.sitePackages}" - "-DPYTHON3_SITEPKG_DIR=$out/${python3.sitePackages}" - ) - ''; + cmakeFlags = [ + "-DWITH_MOZJS=ON" + "-DPYTHON2_SITEPKG_DIR=${placeholder "py2"}/${python2.sitePackages}" + "-DPYTHON3_SITEPKG_DIR=${placeholder "py3"}/${python3.sitePackages}" + ]; - patches = stdenv.lib.optional stdenv.isDarwin + patches = stdenv.lib.optionals stdenv.isDarwin [ (fetchpatch { url = "https://github.com/libproxy/libproxy/commit/44158f03f8522116758d335688ed840dfcb50ac8.patch"; sha256 = "0axfvb6j7gcys6fkwi9dkn006imhvm3kqr83gpwban8419n0q5v1"; - }); + }) + ]; + + postFixup = '' + # config_gnome3 uses the helper to find GNOME proxy settings + wrapProgram $out/libexec/pxgsettings --prefix XDG_DATA_DIRS : "${gsettings-desktop-schemas}/share/gsettings-schemas/${gsettings-desktop-schemas.name}" + ''; doCheck = false; # fails 1 out of 10 tests