-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
nixos/lib/eval-config: add buildPlatform attribute set #221624
Conversation
The new buildPlatform attribute set provides easy access to the cross compilation of NixOS. Platforms included in this attribute set are those exposed by Flakes. The implementation supports both usage of nixpkgs.*Platform as well as nixpkgs.*System.
I don't think I understand the motivation for this, could you elaborate a little bit? |
Sorry for the later response. I had a hard two weeks. Anyway, the point is to allow simple-to-use specification of build platform for flakes. Currently, flakes provide packages in an attribute set where the user chooses the build platform (or it is auto-chosen by nix). In the case of NixOS, this is not simply possible without a little bit of Nix (extending with a module that sets the build platform). The point of this is to provide the ability to specify the build platform just simply by path while supported platforms are the same as for packages. From my point of view the host platform is something that is given for the specific NixOS configuration while the build platform should be more on the user. I do not want to hard-code that you have to use One of possible usages is here https://gitlab.com/Cynerd/nixturris/-/blob/master/flake.nix#L46. I use it in NixTurris as well as in my personal flake to cross-compile NixOS for armv7l and aarch64 systems. The NixTurris is the only repository that converts NixOS to packages, I build others directly (https://gitlab.com/Cynerd/nixos-personal/-/blob/master/tools/common.sh#L82). This is more or less just a suggestion as I wrote. Feel free to suggest a better solution, but my issue is that I want to be more generic about the build platform. |
I'm not a big fan of this because it works around two pretty bad related flaws in Flakes that should be fixed instead: |
It seems to be pretty decided that it is how it is with flakes, at least for now, until a new version of flakes is introduced. I am not sure if we should hope for some miracle and resolution of those issues or if we should just deal with flakes as they are. I can see the reasoning, but at the same time, I have to work with flakes as they are at the moment, and honestly I like flakes anyway. |
A change in |
Description of changes
The new buildPlatform attribute set provides easy access to the cross compilation of NixOS. Platforms included in this attribute set are those exposed by Flakes.
The implementation supports both usage of nixpkgs.*Platform as well as nixpkgs.*System.
This is more or less a suggestion based on my experience of maintaining arm board running NixOS. The idea is to not hardcode build platform and rather let user to select it on build (the same way as it is for packages in flakes). The naming, as well as implementation, is of course, fully open to change on your suggestion.
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)