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
Use cross build packages in extlinux builder when hostPlafrom differs from buildPlatform #62318
Conversation
… from buildPlatform
@matthewbauer Since this is a cross build issue, I feel you might be qualified to review it. |
@@ -8,7 +8,8 @@ let | |||
|
|||
timeoutStr = if blCfg.timeout == null then "-1" else toString blCfg.timeout; | |||
|
|||
builder = import ./extlinux-conf-builder.nix { pkgs = pkgs.buildPackages; }; | |||
builderPkgs = if (pkgs.stdenv.hostPlatform != pkgs.stdenv.buildPlatform) then pkgs else pkgs.buildPackages; | |||
builder = import ./extlinux-conf-builder.nix { pkgs = builderPkgs; }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wolud just do pkgs = pkgs.buildPackages
. On hostPlatform == buildPlatform, it will be the same as pkgs. This would remove the above condition.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The important case I want to address is hostPlatform != buildPlatform
.
If I just pass pkgs = pkgs.buildPackages
, it won't work.
Just to clarify, you suggest to remove the condition and use
builder = import ./extlinux-conf-builder.nix { pkgs = pkgs.buildPackages; };
If so, that fails for me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh ok! I see, I was thinking these would be run on the building machine. But it looks like the install bootloader is run on the target machine. That makes sense now that I think about it. I think a few more of these are messed up. These were done by me in this commit:
Could you see if reverting that fixes the issue? I would prefer to reduce the number of if statements we use here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to revert that commit for all of them besides the sd-* ones. Those /are/ run on the build machine, but installBootLoader is not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Closing this in favor of #62333 |
Motivation for this change
When cross building a system configuration using NixOps and
nixpkgs.crossSystem
, the builder for extlinux is run on the target host and not the build system.The current abstraction places the buildPkgs into the builders path, making the builder fail with unsupported execution formats for things like coreutils.
This change attemts to correct this.
As I am not very experienced with the Nix cross-build setup as a hole, I am not very confident about this change as I don't know the full implications of it.
I apologize in advance for the extra strain this puts on the reviews, I hope we can come to a propper solution in the end.
Things done
sandbox
innix.conf
on non-NixOS)nix-shell -p nix-review --run "nix-review wip"
./result/bin/
)nix path-info -S
before and after)