NixOS on ARM/Raspberry Pi 5: Difference between revisions

DoggoBit (talk | contribs)
No edit summary
DoggoBit (talk | contribs)
No edit summary
Line 68: Line 68:
# Bootstrap a build machine onto the Raspberry Pi 5.
# Bootstrap a build machine onto the Raspberry Pi 5.


=== Stage 1: Building the SD Image ===
=== Step 1: Building the SD Image ===
{{Note|It might be possible to do the following steps via the official SD installer as well. If you manage to do it, please mark this section as optional and remove this notice.}}The project provides build images as well, which are modified versions of the nix-hardware ones. Before getting into building one, in order to make use of the community binary caches, and potentially avoid rebuilding the image, make sure you are added to the trusted users in your own nix configuration:
{{Note|It might be possible to do the following steps via the official SD installer as well. If you manage to do it, please mark this section as optional and remove this notice.}}The project provides build images as well, which are modified versions of the nix-hardware ones. Before getting into building one, in order to make use of the community binary caches, and potentially avoid rebuilding the image, make sure you are added to the trusted users in your own nix configuration:
{{File|filename=nix.conf|language=conf|contents=trusted-users = username}}
{{File|filename=nix.conf|language=conf|contents=trusted-users = username}}
Line 78: Line 78:
$ nix build github:nvdm/nixos-raspberrypi#installerImages.rpi5
$ nix build github:nvdm/nixos-raspberrypi#installerImages.rpi5
</syntaxhighlight>Simply copy the image to the current directory from the <code>result</code> directory, extract it and write it to the SD card. You can find more information on the [[NixOS on ARM/Installation]] page.
</syntaxhighlight>Simply copy the image to the current directory from the <code>result</code> directory, extract it and write it to the SD card. You can find more information on the [[NixOS on ARM/Installation]] page.
=== Step 2: Installing NixOS ===
Once you're running an installer image, you can use [[nixos-anywhere]] to build and install a fresh NixOS system on your Raspberry Pi 5. You can either install nixos-anywhere on your system by adding it to your system or home packages, or you can directly run it as a flake (see the repository's getting started guide).<syntaxhighlight lang="shell">
$ nixos-anywhere --flake .#<system> root@<hostname> --build-on remote
</syntaxhighlight>The nixos-raspberrypi also has an [https://github.com/nvmd/nixos-raspberrypi-demo example configuration].


== Other Solutions ==
== Other Solutions ==