From f61b3e02c05d36c58cb5f5fc793c38df5a79e490 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 2 Sep 2019 15:19:36 +0200 Subject: [PATCH 01/11] glib-networking: format with nixpkgs-fmt --- .../libraries/glib-networking/default.nix | 39 ++++++++++++++----- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix index 4f853e9821ff..95a1a5a2804e 100644 --- a/pkgs/development/libraries/glib-networking/default.nix +++ b/pkgs/development/libraries/glib-networking/default.nix @@ -1,15 +1,24 @@ -{ stdenv, fetchurl, meson, ninja, pkgconfig, glib, gettext, python3, gnutls, p11-kit, libproxy, gnome3 -, gsettings-desktop-schemas }: +{ stdenv +, fetchurl +, meson +, ninja +, pkgconfig +, glib +, gettext +, 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}"; 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"; }; @@ -23,10 +32,20 @@ stdenv.mkDerivation rec { ''; nativeBuildInputs = [ - meson ninja pkgconfig gettext - python3 # install_script + meson + ninja + pkgconfig + gettext + python3 # for install_script + ]; + + propagatedBuildInputs = [ + glib + gnutls + p11-kit + libproxy + gsettings-desktop-schemas ]; - propagatedBuildInputs = [ glib gnutls p11-kit libproxy gsettings-desktop-schemas ]; mesonFlags = [ # Default auto detection doesn't work From 84f318e323989435d5dd54b4038b0af728f20c85 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 2 Sep 2019 15:23:33 +0200 Subject: [PATCH 02/11] glib-networking: drop unnecessary flag auto_features are now enabled by default. --- pkgs/development/libraries/glib-networking/default.nix | 5 ----- 1 file changed, 5 deletions(-) diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix index 95a1a5a2804e..2d64bb861789 100644 --- a/pkgs/development/libraries/glib-networking/default.nix +++ b/pkgs/development/libraries/glib-networking/default.nix @@ -47,11 +47,6 @@ stdenv.mkDerivation rec { gsettings-desktop-schemas ]; - mesonFlags = [ - # Default auto detection doesn't work - "-Dgnutls=enabled" - ]; - doCheck = false; # tests need to access the certificates (among other things) passthru = { From 8c7be1b927d3185bbdadf11694640a020def52b7 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 2 Sep 2019 15:24:12 +0200 Subject: [PATCH 03/11] glib-networking: improve meta * Add maintainers * Add homepage * Correct license as per https://gitlab.gnome.org/GNOME/glib-networking/commit/b9c0324376a5e23b5f8210b0dd76858206baef26 --- pkgs/development/libraries/glib-networking/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix index 2d64bb861789..812cfbda8ffd 100644 --- a/pkgs/development/libraries/glib-networking/default.nix +++ b/pkgs/development/libraries/glib-networking/default.nix @@ -57,7 +57,9 @@ stdenv.mkDerivation rec { 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; }; } From cb1cc757ff6d91323d2f5a70a4da684810970cb9 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 2 Sep 2019 18:50:24 +0200 Subject: [PATCH 04/11] glib-networking: stop propagating dependencies This was done from the beginning for no apparent reason: https://github.com/NixOS/nixpkgs/commit/cc6ecaeeef96e4c09581b9bdb067269861b94c60 --- pkgs/development/libraries/glib-networking/default.nix | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix index 812cfbda8ffd..780ed5e592fc 100644 --- a/pkgs/development/libraries/glib-networking/default.nix +++ b/pkgs/development/libraries/glib-networking/default.nix @@ -22,8 +22,6 @@ stdenv.mkDerivation rec { sha256 = "1mfw44qpmwvz6yzj8c6spx6z357wrmkk15byrkc5byagd82860fm"; }; - outputs = [ "out" "dev" ]; # to deal with propagatedBuildInputs - PKG_CONFIG_GIO_2_0_GIOMODULEDIR = "${placeholder "out"}/lib/gio/modules"; postPatch = '' @@ -39,7 +37,7 @@ stdenv.mkDerivation rec { python3 # for install_script ]; - propagatedBuildInputs = [ + buildInputs = [ glib gnutls p11-kit From 897a09f5e3159d25b2b3289b34c25a35dad6e682 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 2 Sep 2019 18:51:52 +0200 Subject: [PATCH 05/11] glib-networking: clean up --- pkgs/development/libraries/glib-networking/default.nix | 2 -- 1 file changed, 2 deletions(-) diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix index 780ed5e592fc..c2eae0a7e70a 100644 --- a/pkgs/development/libraries/glib-networking/default.nix +++ b/pkgs/development/libraries/glib-networking/default.nix @@ -22,8 +22,6 @@ stdenv.mkDerivation rec { sha256 = "1mfw44qpmwvz6yzj8c6spx6z357wrmkk15byrkc5byagd82860fm"; }; - PKG_CONFIG_GIO_2_0_GIOMODULEDIR = "${placeholder "out"}/lib/gio/modules"; - postPatch = '' chmod +x meson_post_install.py # patchShebangs requires executable file patchShebangs meson_post_install.py From ce4036177bfb716cdc89d565c5dd57fac7b2116a Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 2 Sep 2019 18:55:29 +0200 Subject: [PATCH 06/11] glib-networking: hardcode GSettings path to gnomeproxy module So that this can be loaded from programs not depending on gsettings-desktop-schemas. Currently, this patch is much uglier than it could be due to https://gitlab.gnome.org/GNOME/glib/issues/1884 --- .../libraries/glib-networking/default.nix | 8 + .../glib-networking/hardcode-gsettings.patch | 341 ++++++++++++++++++ 2 files changed, 349 insertions(+) create mode 100644 pkgs/development/libraries/glib-networking/hardcode-gsettings.patch diff --git a/pkgs/development/libraries/glib-networking/default.nix b/pkgs/development/libraries/glib-networking/default.nix index c2eae0a7e70a..21fbd94d1bca 100644 --- a/pkgs/development/libraries/glib-networking/default.nix +++ b/pkgs/development/libraries/glib-networking/default.nix @@ -1,5 +1,6 @@ { stdenv , fetchurl +, substituteAll , meson , ninja , pkgconfig @@ -22,6 +23,13 @@ stdenv.mkDerivation rec { sha256 = "1mfw44qpmwvz6yzj8c6spx6z357wrmkk15byrkc5byagd82860fm"; }; + patches = [ + (substituteAll { + src = ./hardcode-gsettings.patch; + gds_gsettings_path = glib.getSchemaPath gsettings-desktop-schemas; + }) + ]; + postPatch = '' chmod +x meson_post_install.py # patchShebangs requires executable file patchShebangs meson_post_install.py 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); + From ecf6f4aeb1f82d869a52a1cf414a6b02caec1538 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 2 Sep 2019 19:06:54 +0200 Subject: [PATCH 07/11] glib-networking: add installed tests --- nixos/tests/all-tests.nix | 1 + nixos/tests/glib-networking.nix | 17 +++++++++++++ .../libraries/glib-networking/default.nix | 24 ++++++++++++++++++ .../installed-tests-path.patch | 25 +++++++++++++++++++ 4 files changed, 67 insertions(+) create mode 100644 nixos/tests/glib-networking.nix create mode 100644 pkgs/development/libraries/glib-networking/installed-tests-path.patch diff --git a/nixos/tests/all-tests.nix b/nixos/tests/all-tests.nix index 557ee78df7c6..713abbc422bd 100644 --- a/nixos/tests/all-tests.nix +++ b/nixos/tests/all-tests.nix @@ -94,6 +94,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 21fbd94d1bca..ae386f46bffc 100644 --- a/pkgs/development/libraries/glib-networking/default.nix +++ b/pkgs/development/libraries/glib-networking/default.nix @@ -3,9 +3,11 @@ , substituteAll , meson , ninja +, nixosTests , pkgconfig , glib , gettext +, makeWrapper , python3 , gnutls , p11-kit @@ -18,6 +20,8 @@ stdenv.mkDerivation rec { pname = "glib-networking"; version = "2.60.3"; + outputs = [ "out" "installedTests" ]; + src = fetchurl { url = "mirror://gnome/sources/${pname}/${stdenv.lib.versions.majorMinor version}/${pname}-${version}.tar.xz"; sha256 = "1mfw44qpmwvz6yzj8c6spx6z357wrmkk15byrkc5byagd82860fm"; @@ -28,6 +32,8 @@ stdenv.mkDerivation rec { src = ./hardcode-gsettings.patch; gds_gsettings_path = glib.getSchemaPath gsettings-desktop-schemas; }) + + ./installed-tests-path.patch ]; postPatch = '' @@ -40,6 +46,7 @@ stdenv.mkDerivation rec { ninja pkgconfig gettext + makeWrapper python3 # for install_script ]; @@ -53,10 +60,27 @@ stdenv.mkDerivation rec { 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; { 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') From a01a8544f7059c5ed13dde55dc70e6d4ff24092b Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 2 Sep 2019 22:21:27 +0200 Subject: [PATCH 08/11] libproxy: remove outdated comment We no longer propagate dependencies so the comment is not relevant. --- pkgs/development/libraries/libproxy/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/libproxy/default.nix b/pkgs/development/libraries/libproxy/default.nix index 09bb0e4aa3f2..1e906fbeac10 100644 --- a/pkgs/development/libraries/libproxy/default.nix +++ b/pkgs/development/libraries/libproxy/default.nix @@ -13,7 +13,7 @@ stdenv.mkDerivation rec { sha256 = "10swd3x576pinx33iwsbd4h15fbh2snmfxzcmab4c56nb08qlbrs"; }; - outputs = [ "out" "dev" ]; # to deal with propagatedBuildInputs + outputs = [ "out" "dev" ]; nativeBuildInputs = [ pkgconfig cmake ]; From d0ddf6415a6db51695620bce3d3c793b450ad6c6 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 2 Sep 2019 22:22:12 +0200 Subject: [PATCH 09/11] libproxy: split python outputs --- pkgs/development/libraries/libproxy/default.nix | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/pkgs/development/libraries/libproxy/default.nix b/pkgs/development/libraries/libproxy/default.nix index 1e906fbeac10..78709edff644 100644 --- a/pkgs/development/libraries/libproxy/default.nix +++ b/pkgs/development/libraries/libproxy/default.nix @@ -13,7 +13,7 @@ stdenv.mkDerivation rec { sha256 = "10swd3x576pinx33iwsbd4h15fbh2snmfxzcmab4c56nb08qlbrs"; }; - outputs = [ "out" "dev" ]; + outputs = [ "out" "dev" "py2" "py3" ]; nativeBuildInputs = [ pkgconfig cmake ]; @@ -22,13 +22,11 @@ stdenv.mkDerivation rec { then [ SystemConfiguration CoreFoundation JavaScriptCore ] else [ 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 (fetchpatch { From e9953b602c673f1d0524b4df06bd796d8a89feb8 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 2 Sep 2019 22:37:31 +0200 Subject: [PATCH 10/11] libproxy: format with nixpkgs-fmt --- .../libraries/libproxy/default.nix | 47 +++++++++++++++---- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/pkgs/development/libraries/libproxy/default.nix b/pkgs/development/libraries/libproxy/default.nix index 78709edff644..16c90d0a1501 100644 --- a/pkgs/development/libraries/libproxy/default.nix +++ b/pkgs/development/libraries/libproxy/default.nix @@ -1,6 +1,19 @@ -{ 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 +, python2 +, python3 +, SystemConfiguration +, CoreFoundation +, JavaScriptCore +}: stdenv.mkDerivation rec { pname = "libproxy"; @@ -15,12 +28,25 @@ stdenv.mkDerivation rec { outputs = [ "out" "dev" "py2" "py3" ]; - nativeBuildInputs = [ pkgconfig cmake ]; + nativeBuildInputs = [ + pkgconfig + cmake + ]; - 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 [ + spidermonkey_38 + dbus + networkmanager + ]); cmakeFlags = [ "-DWITH_MOZJS=ON" @@ -28,11 +54,12 @@ stdenv.mkDerivation rec { "-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"; - }); + }) + ]; doCheck = false; # fails 1 out of 10 tests From 0aa934aa2daaae81f2f1e6073c92ee0582687a46 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Mon, 2 Sep 2019 22:39:24 +0200 Subject: [PATCH 11/11] libproxy: wrap GSetings helper Add GSettings schemas required for GNOME helper. --- pkgs/development/libraries/libproxy/default.nix | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkgs/development/libraries/libproxy/default.nix b/pkgs/development/libraries/libproxy/default.nix index 16c90d0a1501..844d626f49e3 100644 --- a/pkgs/development/libraries/libproxy/default.nix +++ b/pkgs/development/libraries/libproxy/default.nix @@ -8,6 +8,9 @@ , networkmanager , spidermonkey_38 , pcre +, gsettings-desktop-schemas +, glib +, makeWrapper , python2 , python3 , SystemConfiguration @@ -31,6 +34,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ pkgconfig cmake + makeWrapper ]; buildInputs = [ @@ -43,6 +47,7 @@ stdenv.mkDerivation rec { CoreFoundation JavaScriptCore ] else [ + glib spidermonkey_38 dbus networkmanager @@ -61,6 +66,11 @@ stdenv.mkDerivation rec { }) ]; + 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 meta = with stdenv.lib; {