NixOS on ARM/Building Images: Difference between revisions

Created page with "== Build your own image natively == You can customize image by using the following snippet. <syntaxhighlight lang="nix"> # save as sd-image.nix somewhere { ... }: { imports = [ <nixpkgs/nixos/modules/installer/sd-card/sd-image-aarch64.nix> ]; # put your own configuration here, for example ssh keys: users.users.root.openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1.... username@tld" ]; } </syntaxhighlight> Then build with: <syntaxhighlig..."
 
m Add plan and update with alternatives section
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{ARM/breadcrumb}}
{{outdated|This page needs a cleanup; it was migrated from an organically evolving article from about three wikis ago. The information may still be accurate though.}}<!--
Plan
Make it obvious that this is not a public-facing API. Though the scheme is used for building e.g. armv7l and armv6l images.
Building complex images from the SD image tooling is not supported, and will not be.
-->
== Build your own image natively ==
== Build your own image natively ==


Line 93: Line 103:


It is also possible to build nixos images through full emulation using QEMU/kvm but will be way slower than native and binfmt QEMU.
It is also possible to build nixos images through full emulation using QEMU/kvm but will be way slower than native and binfmt QEMU.
== Alternatives to building custom images ==
=== Stock NixOS installer image with custom U-Boot ===
The [https://github.com/Mic92/nixos-aarch64-images Mic92/nixos-aarch64-images] repository provides a mechanism to modify the official NixOS installer to embed the board-specific U-Boot firmware required for different boards. This method does not require QEMU or native ARM builds since the existing Hydra-built U-Boot binaries are used.
=== Editing the image manually ===
For some simple operations, like adding an SSH public key, the expected usage for new users is to manually edit the image, add the proper directory and <tt>authorized_keys</tt> file, with proper modes.
<syntaxhighlight lang="console">
$ namei -l /home/nixos/.ssh/authorized_keys
f: /home/nixos/.ssh/authorized_keys
drwxr-xr-x root  root  /
drwxr-xr-x root  root  home
drwx------ nixos  users nixos
drwx------ nixos  users .ssh
-rw------- nixos  users authorized_keys
</syntaxhighlight>