about summary refs log tree commit diff
path: root/pkgs/development/libraries/gobject-introspection/wrapper.nix
diff options
context:
space:
mode:
authorArtturin <Artturin@artturin.com>2022-07-22 06:21:40 +0300
committerArtturin <Artturin@artturin.com>2022-07-22 06:21:40 +0300
commitd2e484dba21e930c97bc6ae5ad2bb0be4cf28021 (patch)
tree8d2545efd20065a9f9de46cdf4c9278f29c0f6d5 /pkgs/development/libraries/gobject-introspection/wrapper.nix
parent77085e9b2b81942660f5e0aea364efac9d681160 (diff)
gobject-introspection: fix .override when the wrapper is in use
Diffstat (limited to 'pkgs/development/libraries/gobject-introspection/wrapper.nix')
-rw-r--r--pkgs/development/libraries/gobject-introspection/wrapper.nix19
1 files changed, 14 insertions, 5 deletions
diff --git a/pkgs/development/libraries/gobject-introspection/wrapper.nix b/pkgs/development/libraries/gobject-introspection/wrapper.nix
index 44d31540e6456..711b8aab83545 100644
--- a/pkgs/development/libraries/gobject-introspection/wrapper.nix
+++ b/pkgs/development/libraries/gobject-introspection/wrapper.nix
@@ -1,13 +1,22 @@
 { lib
 , stdenv
 , buildPackages
-, gobject-introspection-unwrapped
 , targetPackages
-}:
+, gobject-introspection-unwrapped
+, ...
+}@_args:
 
 # to build, run
-# `nix build ".#pkgsCross.aarch64-multiplatform.buildPackages.gobject-introspection"`
-gobject-introspection-unwrapped.overrideAttrs (_previousAttrs: {
+# 'nix build ".#pkgsCross.aarch64-multiplatform.buildPackages.gobject-introspection"'
+
+let
+  # ensure that `.override` works when gobject-introspection == gobject-introspection-wrapped
+  args = builtins.removeAttrs _args [ "buildPackages" "targetPackages" "gobject-introspection-unwrapped" ];
+  # passing this stdenv to `targetPackages...` breaks due to splicing not working in `.override``
+  argsForTarget = builtins.removeAttrs args [ "stdenv" ];
+in
+
+(gobject-introspection-unwrapped.override args).overrideAttrs (_previousAttrs: {
   pname = "gobject-introspection-wrapped";
   postFixup = ''
     mv $dev/bin/g-ir-compiler $dev/bin/.g-ir-compiler-wrapped
@@ -18,7 +27,7 @@ gobject-introspection-unwrapped.overrideAttrs (_previousAttrs: {
       export emulator=${lib.escapeShellArg (stdenv.targetPlatform.emulator buildPackages)}
       export buildprelink="${buildPackages.prelink}/bin/prelink-rtld"
 
-      export targetgir="${lib.getDev targetPackages.gobject-introspection-unwrapped}"
+      export targetgir="${lib.getDev (targetPackages.gobject-introspection-unwrapped.override argsForTarget)}"
 
       substituteAll "${./wrappers/g-ir-compiler.sh}" "$dev/bin/g-ir-compiler"
       substituteAll "${./wrappers/g-ir-scanner.sh}" "$dev/bin/g-ir-scanner"