-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Overlays have incorrect stdenv.hostPlatform
starting in NixOS 24.05
#325318
Comments
I'm curious about your usecase: why would you pull system from prev instead of final? |
This is in relation to the ethereum.nix project. Specific this issue. Basically we want to create an overlay which contains all the packages from the ethereum.nix flake that match the system of the hostPlatform. Here is the current implementation (that works pre NixOS 24.05). If you have ideas for a better/more reliable approach I'd love to hear them.
Can you? When I tried to use |
That said while there may be a workaround in this particular use-case, I am much more concerned about the bigger picture here. It would seem (unless I'm misunderstanding something) that NixOS is for some reason changing the |
I had exact this error when doing nixos test on "nothing" (test is just "echo 42" service). Have run nix flake update and error gone. |
I seem to be having a very similar problem with my system (x86_64). I'm trying to use a custom openssl, so a lot of packages have to be rebuilt. I ran into this issue because the package ibm-sw-tpm2 is being built as i686-linux and is throwing the error "Ossl library is using a different radix". It seems like many packages are being built as i686, because the dependencies of ibm-sw-tpm2 are also being built that way. Currently I can't rebuild my system without removing the custom openssl.
For some reason, /nix/store/fmmkqsw5jxjhxaj6m1jlxzjbnvyxsl54-pipewire-1.2.3.drv is the last to be i686-linux, and then /nix/store/b8iihwswa5afhq01hhx0v8bijjdncv18-gamemode-1.8.2.drv is x86_64-linux as usual. |
Git bisect leads me to believe that first "bad" commit that causes this issue is 0863f6d, although checking over it quickly, I don't see anything in there that would cause the issue, although I'm not an expert at Nix. I can reproduce the issue on 0863f6d, but on the previous commit, bf6f0d3, there doesn't seem to be any problem. |
@tejing1 if you're not busy, would you be able to take a look? After looking over the commit some more, I'm still not sure what causes the issue. |
stub-ld on an x86_64 system builds a stub loader for i686 as well. That means it depends on the i686 versions of stdenv, as well as unixtools.xxd. If you use an overlay that alters those in such a way that they don't work on i686, then failure is expected. Rather than packages being built for the "wrong" system, they're being built for multiple systems, and the i686 case is failing, I believe. To verify, you can try setting |
In my case the package that's being built as i686 is ibm-sw-tpm2 (alongside many other packages). To me it seems like that isn't a package that should be built because of stub-ld, unless it rebuilds almost every package? On my current system, ibm-sw-tpm2 is indeed using x86_64 (and doesn't have any i686 derivations), and I'm on unstable. The only meaningful thing that changed was adding nixpkgs.config.packageOverrides = pkgs: rec {
# This openssl only has x86_64? It shouldn't matter, right?
openssl = inputs.openssl-quantum.packages.x86_64-linux.default;
}; I used git bisect with the reproduction steps above, instead of attempting to build my own system and every package in it, because that would take forever, so it's possible my issue is different from this one. Also, |
I would assume Furthermore, that overlay applies to the x86_64 packages, but also the i686 packages. However you're injecting an x86_64 package into it in both cases. When you throw a 64-bit openssl into a 32-bit build process, obviously things are going to go wrong. |
I understood what the error and why it was happening, mixing i686 and x86_64 doesn't go well obviously. What I didn't understand was why Now I'm wondering if this is even a real issue with nixos or maybe my problem is separate. |
Describe the bug
Starting with NixOS 24.05, the value of
prev.stdenv.hostPlatform.system
will fall back toi686-linux
when the actual host platform is set tox86_64-linux
when building NixOS configuration.Steps To Reproduce
Steps to reproduce the behavior:
nixpkgs
input using at least NixOS 24.05nix repl
:nixosSystem = module: inputs.nixpkgs.lib.nixosSystem { system = "x86_64-linux"; modules = [ module ]; }
nixosConfig = nixosSystem { nixpkgs.overlays = [(_final: prev: builtins.trace prev.stdenv.hostPlatform.system {})]; }
nixosConfig.config.system.build.toplevel
trace: x86_64-linux
gets printed several times, however at some point it switches totrace: i686-linux
and prints that many more timesExpected behavior
All invocations of of the overlay should have
stdenv.hostPlatform
set correctly to the system provided in the call tonixosSystem
Additional context
From my poking around with this I have found the following:
import inputs.nixpkgs { overlays = [(_final: prev: builtins.trace prev.stdenv.hostPlatform.system {})]; }.hello
works correctly and only prints the actual host systemnixosConfig.config
as the last step to force evaluation of the overlays only prints the correct systemaarch64-linux
as the system seems to work as expected. Not sure what to make of this. Maybe it's trying to "downgrade" the architecture to 32 bit but can't for ARM?Notify maintainers
Issue appears to be at a fair low-level within NixOS itself (or perhaps the module/overlay system?). Not sure who to put here
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.(note I have tested this on a number of different nix versions and host OSs/architecture. The only commonality seems to be what version of NixOS I am using in the flake input)
Add a 👍 reaction to issues you find important.
The text was updated successfully, but these errors were encountered: