Skip to content
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

host for aarch64 system #125

Closed
liaowang11 opened this issue Feb 17, 2021 · 4 comments
Closed

host for aarch64 system #125

liaowang11 opened this issue Feb 17, 2021 · 4 comments
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@liaowang11
Copy link

Describe the bug
Adding an aarch64 system with aarch64 specific packages (like libraspberrypi) gives error:

Package ‘libraspberrypi’ in /nix/store/widqcq445r5r4ivh7sdfibhjrpq69jgl-source/pkgs/development/libraries/libraspberrypi/default.nix
:19 is not supported on ‘x86_64-linux’, refusing to evaluate.

To Reproduce
Steps to reproduce the behavior:

  1. Add raspi4.nix to /hosts
  2. run flk raspi4 dry-run
  3. errors with content like above
#raspi4.nix
#…
  environment.systemPackages = with pkgs; [                                     
      libraspberrypi                                                              
   ]; 
#…

Expected behavior
Dry run should succeed

Additional context
I’m trying to use flake to config all my machines. This template is the best I can find, but still does not fully support multi-arch. Have tried hlissner’s dotfiles, also not working.
The dotfiles from Dunklecat is the only one I ‘ve found support both aarch64 and x86_64. Hope flk can support it.

@nrdxp
Copy link
Collaborator

nrdxp commented Feb 17, 2021

The only reason I haven't wired up multiarch for configs is because the flake spec doesn't expect system attributes under nixosConfigurations, and adding them screws up nixos rebuild and friends.

I have been thinking about the best way to resolve this, and perhaps a non standard output is the best way for now. You can of course, change the system:
https://github.com/nrdxp/nixflk/blob/77296ff433c0dc6e9b5cad522b6a46dafaa204ba/flake.nix#L53

And it should work, but this will change the system for all your hosts. I think I'll just add a nixos output with aarch and i686 configs later today. The other option would be to simply patch nix directly.

@Pacman99
Copy link
Member

AIUI the reason theres no multi-arch nixosConfigurations output like the packages output works, is that it doesn't make sense for the same nixosConfiguration to be used under multiple archs. If you want a aarch64 nixosConfiguration output, your supposed make the nixosSystem specifically for that aarch64 system. And that makes sense with nixflk's structure since each host is meant for one system, so you just make a new host file for your aarch64 system.

I think the main issue is that nixflk doesn't allow changing the system that gets passed to the nixosSystem function since its always "x86_64-linux". As a workaround I think you can override nixpkgs.localSystem to aarch64. From what I saw in nixpkgs, thats where the system input to nixosSystem function gets used. But its set as a default, so you could just do:
nixpkgs.localSystem = { config = "aarch64-unknown-linux-gnu"; system = "aarch64-linux"; }
or you could just set crossSystem, if you are building the aarch64 config on an x86_64 system.

I think a better solution would be to allow changing the system, possibly by making a new option for it and passing it to nixosSystem.

@nrdxp
Copy link
Collaborator

nrdxp commented Feb 17, 2021

The problem is that nixpkgs.localSystem is ignored when nixpkgs.pkgs is set.

@nrdxp nrdxp added the enhancement New feature or request label Feb 17, 2021
@nrdxp
Copy link
Collaborator

nrdxp commented Feb 17, 2021

duplicate of #72, let's track progress there

@nrdxp nrdxp closed this as completed Feb 17, 2021
@nrdxp nrdxp added the duplicate This issue or pull request already exists label Feb 17, 2021
bors bot added a commit that referenced this issue Mar 19, 2021
161: Multi-arch support for hosts(nixosConfigurations) r=nrdxp a=Pacman99

fixes #72 

also related, #125 

This allows users to set `nixpkgs.system` to any architecture exported by the nixpkgs flake and nixpkgs.pkgs will be set to that system.

I also added `multiPkgs` as a special arg and made `nixpkgs.pkgs` a default. So if someone wanted to do crossSystem builds or anything else with pkgs, that is also an option(eg. mobile-nixos!!).

Co-authored-by: Pacman99 <pachum99@gmail.com>
Pacman99 added a commit that referenced this issue Feb 26, 2022
125: customBuilds: use mkDefault for freeform type r=blaggacao a=Pacman99

fixes #419

Co-authored-by: Parthiv Seetharaman <pachum99@myrdd.info>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants