From b5406a66996e48a33fffb3acfd64808a6f78a545 Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Thu, 18 Dec 2025 10:01:38 +0100 Subject: [PATCH 1/2] gobject-introspection: improve support for structuredAttrs With `__structuredAttrs = true;` $outputLib is not available as an exported environment variable. To avoid polluting the env with a generic variable that could be abused, use a bespoke and easily greppable variable. --- .../gobject-introspection/absolute_shlib_path.patch | 7 ++----- .../libraries/gobject-introspection/setup-hook.sh | 10 ++++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch b/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch index b6dc66fc66b1..bfee16860274 100644 --- a/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch +++ b/pkgs/development/libraries/gobject-introspection/absolute_shlib_path.patch @@ -2,15 +2,12 @@ diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py index 64575557..1eb0a2b4 100644 --- a/giscanner/scannermain.py +++ b/giscanner/scannermain.py -@@ -95,6 +95,39 @@ def get_windows_option_group(parser): +@@ -95,6 +95,36 @@ def get_windows_option_group(parser): return group +def _get_default_fallback_libpath(): -+ # Newer multiple-output-optimized stdenv has an environment variable -+ # $outputLib which in turn specifies another variable which then is used as -+ # the destination for the library contents (${!outputLib}/lib). -+ store_path = os.environ.get(os.environ.get("outputLib")) if "outputLib" in os.environ else None ++ store_path = os.environ.get("NIX_GOBJECT_INTROSPECTION_DEFAULT_FALLBACK_LIBPATH") + if store_path is None: + outputs = os.environ.get("outputs", "out").split() + if "lib" in outputs: diff --git a/pkgs/development/libraries/gobject-introspection/setup-hook.sh b/pkgs/development/libraries/gobject-introspection/setup-hook.sh index ee048867a278..e05f80a27cb9 100644 --- a/pkgs/development/libraries/gobject-introspection/setup-hook.sh +++ b/pkgs/development/libraries/gobject-introspection/setup-hook.sh @@ -10,7 +10,17 @@ make_gobject_introspection_find_gir_files() { fi } +export_gobject_introspection_fallback_path() { + # Newer multiple-output-optimized stdenv has a variable $outputLib, + # which in turn specifies another variable which then is used as + # the destination for the library contents (${!outputLib}/lib). + # We export this so it is available to subprocesses, such as giscanner, + # which we patch to prioritize this variable if available. + export NIX_GOBJECT_INTROSPECTION_DEFAULT_FALLBACK_LIBPATH=${!outputLib} +} + addEnvHooks "$targetOffset" make_gobject_introspection_find_gir_files +addEnvHooks "$targetOffset" export_gobject_introspection_fallback_path giDiscoverSelf() { if [ -d "$prefix/lib/girepository-1.0" ]; then From 180276ea5c2ac7ee7009045db49f2916a226c64a Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Fri, 19 Dec 2025 02:12:47 +0100 Subject: [PATCH 2/2] libxmlb: enable structuredAttrs to test fix in gobject-introspection --- pkgs/by-name/li/libxmlb/package.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkgs/by-name/li/libxmlb/package.nix b/pkgs/by-name/li/libxmlb/package.nix index 8d91adeaf782..1604752dd688 100644 --- a/pkgs/by-name/li/libxmlb/package.nix +++ b/pkgs/by-name/li/libxmlb/package.nix @@ -85,6 +85,8 @@ stdenv.mkDerivation rec { }; }; + __structuredAttrs = true; + meta = { description = "Library to help create and query binary XML blobs"; mainProgram = "xb-tool";