Skip to content

python3: splices do not compose correctly #476822

Description

@alois31

Nixpkgs version

  • Unstable (26.05)

Describe the bug

When using multiple of pythonOnBuildForBuild, pythonOnBuildForHost, pythonOnBuildForTarget, pythonOnHostForHost, pythonOnTargetForTarget in sequence, they do not compose as expected.

Steps to reproduce

Run nix repl --expr 'import ./. { localSystem = "x86_64-linux"; crossSystem = "aarch64-linux"; }' in a current nixpkgs unstable. Try to compose the python splices:

nix-repl> buildPackages.python3.pythonOnBuildForHost.pythonOnTargetForTarget
«derivation /nix/store/7a8v3c2rwa5k503d71yl8xpnal0b9wam-python3-aarch64-unknown-linux-gnu-3.13.11.drv»

nix-repl> buildPackages.python3.pythonOnTargetForTarget
«derivation /nix/store/7a8v3c2rwa5k503d71yl8xpnal0b9wam-python3-aarch64-unknown-linux-gnu-3.13.11.drv»

nix-repl> buildPackages.buildPackages.python3.pythonOnTargetForTarget        
«derivation /nix/store/2s2zik6gyc4s3pf1nm7lbfii8699dsab-python3-3.13.11.drv»

Observe that the composition doesn't work: the first line gives the same result as the second line.

Expected behaviour

Composition works: the first line gives the same result as the third line.

Screenshots

No response

Relevant log output

Additional context

Due to their usage in splicing (

otherSplices = {
selfBuildBuild = pythonOnBuildForBuild.pkgs;
selfBuildHost = pythonOnBuildForHost.pkgs;
selfBuildTarget = pythonOnBuildForTarget.pkgs;
selfHostHost = pythonOnHostForHost.pkgs;
selfTargetTarget = pythonOnTargetForTarget.pkgs or { }; # There is no Python TargetTarget.
};
), the incorrect composition of Python splices will cause setuptools-rust to receive the wrong pythonOnTargetForTarget (
pyLibDir = "${python.pythonOnTargetForTarget}/lib/${python.pythonOnTargetForTarget.libPrefix}";
), breaking builds of dependents such as buildPackages.python3Packages.bcrypt and in turn the cross-compiled lix.

Another Python splicing issue is known (#211340) but I believe this one is a separate bug.

System metadata

  • system: "x86_64-linux"
  • host os: Linux 6.18.2, NixOS, 26.05 (Yarara), 26.05pre921484.fb7944c166a3
  • multi-user?: yes
  • sandbox: yes
  • version: nix-env (Lix, like Nix) 2.95.0 System type: x86_64-linux Additional system types: i686-linux, x86_64-v1-linux, x86_64-v2-linux, x86_64-v3-linux Features: gc, signed-caches System configuration file: /etc/nix/nix.conf User configuration files: [elided] Store directory: /nix/store State directory: /nix/var/nix Data directory: /nix/store/icvwjyw1hk7wjn4w4gr9ap1whnrrrvxh-lix-2.95.0-pre-d387c9113c73/share
  • nixpkgs: /nix/store/59b0b5ajzxqh7b9dhq2bi4s79kgg7hxz-nixpkgs

Notify maintainers


Note for maintainers: Please tag this issue in your pull request description. (i.e. Resolves #ISSUE.)

I assert that this issue is relevant for Nixpkgs

Is this issue important to you?

Add a 👍 reaction to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions