From 1539819ad80ef6eb8842983f3af0a3a438c0d074 Mon Sep 17 00:00:00 2001 From: Artturin Date: Sun, 3 Nov 2024 00:48:35 +0200 Subject: [PATCH] gobject-introspection: Conditionalize `depsTargetTargetPropagated` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes ↓ ``` nix-repl> pkgsCross.x86_64-freebsd.pkgsBuildHost.gobject-introspection error: Don't know how to run x86_64-unknown-freebsd executables. ``` The unwrapped already doesn't error ``` nix-repl> pkgsCross.x86_64-freebsd.pkgsBuildHost.gobject-introspection-unwrapped «derivation /nix/store/xq4q4vigy2glmfng2h6bbr4sysyk8ipz-gobject-introspection-1.82.0.drv» ``` https://www.github.com/NixOS/nixpkgs/blob/7b1cffdd2e13b2cdad5b37e259016efd0ea48fcd/pkgs/development/libraries/gobject-introspection/default.nix#L114 It's caused by `depsTargetTargetPropagated = [ overridenTargetUnwrappedGir ];` in the wrapper In `graphene` there is `PATH=${python3.withPackages (pp: [ pp.pygobject3 pp.tappy ])}/bin:$PATH patchShebangs tests/introspection.py` Which causes the `Don't know` error in `pkgsCross.x86_64-freebsd.pkgsBuildHost.graphene` because `python3` and `pygobject3` will be from `pkgsHostTarget` and then `pygobject3` has `gobject-introspection` from `pkgsHostTarget` and then that `gobject-introspection` will have `pkgsCross.x86_64-freebsd.pkgsCross.x86_64-freebsd.buildPackages.pkgsTargetTarget.gobject-introspection.gobject-introspection` in `depsTargetTargetPropagated` To test that importing the python library `gi` works without `depsTargetTargetPropagated` ```nix let pkgs = (import ./. { crossSystem = (import ./lib).systems.examples.aarch64-multiplatform; # On `master` uncomment this and comment `propagatedBuildInputs` below and you'll get # error: Don't know how to run x86_64-unknown-freebsd executables. #crossSystem = (import ./lib).systems.examples.x86_64-freebsd; overlays = [ (_: prev: { pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [ (_: pprev: { pygobject3-test = pprev.pygobject3.overrideAttrs { propagatedBuildInputs = [ pprev.pycairo (prev.gobject-introspection.overrideAttrs { depsTargetTargetPropagated = [ ]; }) ]; }; }) ]; }) ]; }).pkgs; pyr = pkgs.pkgsBuildHost.python3Packages.python.withPackages (pp: [ pp.pygobject3-test ]); in pkgs.pkgsBuildBuild.runCommand "test" { } '' "${pyr.interpreter}" -c "import gi" && touch "$out" '' ``` --- pkgs/development/libraries/gobject-introspection/wrapper.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/development/libraries/gobject-introspection/wrapper.nix b/pkgs/development/libraries/gobject-introspection/wrapper.nix index 53b1a35f82125..6fa18befa97bf 100644 --- a/pkgs/development/libraries/gobject-introspection/wrapper.nix +++ b/pkgs/development/libraries/gobject-introspection/wrapper.nix @@ -94,7 +94,7 @@ else unwrapped = overriddenUnwrappedGir; }; dontStrip = true; - depsTargetTargetPropagated = [ overridenTargetUnwrappedGir ]; + depsTargetTargetPropagated = lib.optionals (stdenv.targetPlatform.emulatorAvailable buildPackages) [ overridenTargetUnwrappedGir ]; buildCommand = '' eval fixupPhase ${lib.concatMapStrings (output: ''