Prototype aarch64 ami builder for amazon ec2

I recently generated a aarch64 AMI image that manages to boot on Amazon’s A1 instances.

So, I wanted to leave this commit here for whovever the next person is that is looking for a starting point: experimental: compile AMI for arm64 · rehno-lindeque/nixpkgs@7fd9d55 · GitHub

Would be amazing to get some official NixOS AMI going at some point so people can quickly spin up private remote builders for themselves.

Notes:
I took the shortest, quick & dirty path to getting something working. There’s one or two harmless seeming error messages during boot.
Also got started on top of someone’s cross-compilation branch but couldn’t get cross-compilation working. So, this commit is no based on master. But I suspect it should basically cherry-pick cleanly onto the current nixpkgs master.

Thanks

3 Likes

Some follow-up for how to then deploy with nixops over here: AWS ARM A1 instances · Issue #52779 · NixOS/nixpkgs · GitHub

This sounds handy - I have a pinebook pro which is aarch64 based, but aside from being slow it is rather limited in memory, and seems to be unable to build some software due to this:

[154 of 357] Compiling Agda.Interaction.Library ( src/full/Agda/Interaction/Library.hs, dist/build/Agda/Interaction/Library.o )
[155 of 357] Compiling Agda.Utils.IO.Directory ( src/full/Agda/Utils/IO/Directory.hs, dist/build/Agda/Utils/IO/Directory.o )
[156 of 357] Compiling Agda.Interaction.Options ( src/full/Agda/Interaction/Options.hs, dist/build/Agda/Interaction/Options.o )
[157 of 357] Compiling Agda.TypeChecking.Monad.Base ( src/full/Agda/TypeChecking/Monad/Base.hs, dist/build/Agda/TypeChecking/Monad/Base.o )
/nix/store/2sbj5bl69mjilbar7amlqhbdv4jfvr34-stdenv-linux/setup: line 1300:   248 Killed                  ./Setup build
builder for '/nix/store/drzyyhaxlai81lv77yqmmyshd251wr9k-Agda-2.6.0.1.drv' failed with exit code 137
error: build of '/nix/store/6y74h0gqgfcw8xv0m9nnixramc2hr12l-emacs-nox-with-packages-26.3.drv', '/nix/store/drzyyhaxlai81lv77yqmmyshd251wr9k-Agda-2.6.0.1.drv', '/nix/store/x23qbwnkyvkv6q3nwirn5cznm6gyc2aw-ghc-8.6.5-with-packages.drv' failed

Once I’ve built a package, is there any way to get it added to the official Nix cache (so that I and others could then easily consume the packages)?