Closed dnadlinger closed 2 years ago
The issue is the hooks are not being overridden. This results in them providing the default unoptimised versions. Because the other native build input also propagate these packages, but the correct ones, we get collisions.
Interpreters have an attribute
pythonForBuild = pythonOnBuildForHost.override { inherit packageOverrides; self = pythonForBuild; };
and
pythonOnBuildForHost = pkgsBuildHost.${pythonAttr};
which picks up the build for host interpreter from the spliced package set. In other words, the only way to override correctly is by using an overlay.
Nixpkgs at e1212c4c2812e92d1c7cbed63eb0e417de89a430 and file python.nix
:
with import ./. {};
let
python = python3.override {
reproducibleBuild = true;
enableOptimizations = false;
rebuildBytecode = false;
enableLTO = false;
self = python;
};
in { inherit python; }
[freddy@fr-yoga:~/code/nixpkgs]$ nix-build python.nix -A python
/nix/store/i7sapm6pi7323l730kjf54aap7r3awr0-python3-3.9.12
[freddy@fr-yoga:~/code/nixpkgs]$ nix-build python.nix -A python.pythonForBuild
/nix/store/hym1n0ygqp9wcm7pxn4sfrql3fg7xa09-python3-3.9.12
[freddy@fr-yoga:~/code/nixpkgs]$ nix-build -A python3
/nix/store/hym1n0ygqp9wcm7pxn4sfrql3fg7xa09-python3-3.9.12
[freddy@fr-yoga:~/code/nixpkgs]$ nix-build -A python3.pythonForBuild
/nix/store/hym1n0ygqp9wcm7pxn4sfrql3fg7xa09-python3-3.9.12
Thanks!
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/why-is-the-nix-compiled-python-slower/18717/5
Describe the bug
According to the Nix Python docs, it should be possible to enable optimisations using
python3.override
. However, this doesn't actually appear to work if some packages are required, among them aiohttp and filelock.Steps To Reproduce
Try to build the following flake:
Expected behavior
This should build successfully.
Additional context
The
nix-store -q --tree
output is 2245 lines long, but the two different instances of the libraries are clearly visible: filelock-deps.txtNot sure I understand what is going on here, but does this potentially involve some cyclic dependencies between Python packages?
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.