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

Compatibility for "cross-architecture" installation #18

Open
TheSirC opened this issue Jan 1, 2023 · 11 comments
Open

Compatibility for "cross-architecture" installation #18

TheSirC opened this issue Jan 1, 2023 · 11 comments
Labels
enhancement New feature or request

Comments

@TheSirC
Copy link

TheSirC commented Jan 1, 2023

Thank you a lot for this !

Is it possible to use this method to remote install Raspberry Pi (and generally different architectures than the client connecting to ssh host to install nixos on) from a x86_64 system?

@TheSirC TheSirC added the enhancement New feature or request label Jan 1, 2023
@phaer
Copy link
Member

phaer commented Jan 3, 2023

I think there's nothings which should stop this from working on a Raspberry Pi in theory, but I don't believe it has been tried before.

@Mic92 Just exposed aarch64 for the kexec images https://github.com/nix-community/nixos-images/pull/50/files, but this flake might need adaptions.

@Mic92
Copy link
Member

Mic92 commented Jan 3, 2023

I mainly need time to prepare ci for aarch64...

@Mic92
Copy link
Member

Mic92 commented Jan 3, 2023

Btw if you possess some other arm64 machine that can act as a remote builder, than you can already deploy nixos to a new machine as described here: https://github.com/numtide/nixos-remote#using-your-own-kexec-image

This is what I have done for the nix-community oracle builder: https://github.com/nix-community/infra/blob/6e89a59895ef690e2918a5dabbf92241e7464c19/build04/configuration.nix#L42

@arjan-s
Copy link

arjan-s commented Apr 8, 2023

Hi, has there been progress on this? I was hoping to use it to install a new aarch64 machine.

I used the aarch64 kexec installer using this command:

nix run github:numtide/nixos-anywhere -- <hostname> --flake .#<hostname> --kexec "$(nix build --print-out-paths github:nix-community/nixos-images#packages.aarch64-linux.kexec-installer-nixos-unstable)/nixos-kexec-installer-aarch64-linux.tar.gz"

but encountered the following error:

error: a 'aarch64-linux' with features {} is required to build '/nix/store/pr53dvbv21q1ajp3fhrk5zy1d5qpy8gj-append-initrd-secrets.drv', but I am a 'x86_64-linux' with features {benchmark, big-parallel, kvm, nixos-test}

curl: (3) URL using bad/illegal format or missing URL

gzip: stdin: unexpected end of file
tar: Child returned status 1
tar: Error is not recoverable: exiting now

@phaer
Copy link
Member

phaer commented Apr 8, 2023

Iiuc you'd still need an aarch64 (remote) builder for the nixos-anywhere parts, even if you use a pre-built aarch64 installer image.

We still don't have CI for aarch64 yet, maybe @Mic92 has plans for it? :)

@Mic92
Copy link
Member

Mic92 commented Apr 8, 2023

Some progress has been made on aarch64 CI: nix-community/nixos-images#87

@arjan-s
Copy link

arjan-s commented Apr 8, 2023

Actually, it worked perfectly after adding the following line to my laptop's config:

boot.binfmt.emulatedSystems = [ "aarch64-linux" ];

I used the nixos-anywhere command I listed in my previous comment to successfully install an Oracle (free tier) aarch64 host.
This line configured my laptop to 'understand' aarch64 building through qemu.

@nixos-discourse
Copy link

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/cross-build-x86-64-ami-on-aarch64-using-nixos-generators/39098/2

@genebean
Copy link

genebean commented Feb 5, 2024

I am also getting the

error: a 'aarch64-linux' with features {} is required to 
build '/nix/store/nbykp926jwdpnp6aj2cbkygkwv16256m-default-conf.json.drv', 
but I am a 'x86_64-darwin' with features {benchmark, big-parallel, nixos-test}

when I run this:

nix run github:nix-community/nixos-anywhere -- \
--flake .#hetznix01 -i ~/.ssh/id_ed25519 \
--build-on-remote root@<redacted>

(line breaks added to both things above to make them easier to read)

The thing that has me confused, and may make this a different issue, is I am passing --build-on-remote which, I would think, would avoid the issue of my laptop not being the right architecture. Anyone here have any thoughts on either what I am doing wrong or how to work around it? I do have an x86_64-linux laptop running NixOS I could deploy from if needed.

@Mic92
Copy link
Member

Mic92 commented Feb 6, 2024

For this feature to work, your own local user needs to be a trusted nix user.

@genebean
Copy link

genebean commented Feb 6, 2024

For this feature to work, your own local user needs to be a trusted nix user.

The user is in the list of trusted ones.

The one I tried from a NixOS host is in this one:

https://github.com/genebean/dots/blob/437a34a26dba30cc926a543e21dee053783eb6a5/modules/system/common/all-nixos.nix#L43

When I tried from macOS, it is in this one:

https://github.com/genebean/dots/blob/437a34a26dba30cc926a543e21dee053783eb6a5/modules/system/common/all-darwin.nix#L91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants