NixOS on ARM/Raspberry Pi: Difference between revisions

imported>Samueldr
m Remove installer profile from examples
imported>Samueldr
Begin scrubbing the Pi 3 parts out
Line 31: Line 31:
== Status ==
== Status ==


Only the ''Raspberry Pi 3 Family'' is supported upstream, with the AArch64 effort. Other Raspberry Pis are part of '''@dezgeg''''s porting efforts to ARMv6 and ARMv7.
Only the ''Raspberry Pi 3 Family'' is supported upstream, with the AArch64 effort.
 
The Raspberry Pi 4B is not <em>supported</em> by NixOS, though a beta-quality disk image specific for it is produced. It will be supported the same as the Pi 3 family once the mainline kernel and mainline U-Boot boot fine through the generic mainline image.
 
Other Raspberry Pis (0, 1, and 2) are part of diverse community porting efforts to ARMv6 and ARMv7.


The Linux kernel in use, except for the Raspberry Pi 1 family, is the mainline Linux kernel, and not the Raspberry Pi Foundation's fork. This could reduce compatibility with some add-on boards or third-party libraries<sup>[expanded explanation needed]</sup>.
The Linux kernel in use, except for the Raspberry Pi 1 family, is the mainline Linux kernel, and not the Raspberry Pi Foundation's fork. This could reduce compatibility with some add-on boards or third-party libraries<sup>[expanded explanation needed]</sup>.
Line 69: Line 73:
!colspan="3" style="text-align: left;"|Raspberry Pi 3
!colspan="3" style="text-align: left;"|Raspberry Pi 3
|-
|-
| Raspberry Pi 3 Model B
| [[NixOS on ARM/Raspberry Pi 3|Raspberry Pi 3 Model B]]
|rowspan="3" style="vertical-align: middle;"| AArch64<br /> ''+ armv7''
|rowspan="3" style="vertical-align: middle;"| AArch64<br /> ''+ armv7''
| YES
| YES
|-
|-
| Raspberry Pi 3 Model B+
| [[NixOS on ARM/Raspberry Pi 3|Raspberry Pi 3 Model B+]]
| YES
| YES
|-
|-
| Raspberry Pi 3 Model A+
| [[NixOS on ARM/Raspberry Pi 3|Raspberry Pi 3 Model A+]]
| ?
| ?
|-
|-
!colspan="3" style="text-align: left;"|Raspberry Pi 4
!colspan="3" style="text-align: left;"|Raspberry Pi 4
|-
|-
| Raspberry Pi 4 Model B
| [[NixOS on ARM/Raspberry Pi 4|Raspberry Pi 4 Model B]]
| AArch64<br /> ''+ armv7''
| AArch64<br /> ''+ armv7''
| YES* ([https://github.com/NixOS/nixpkgs/issues/63720 GitHub issue])
| YES* ([https://github.com/NixOS/nixpkgs/issues/63720 GitHub issue])
Line 109: Line 113:
=== Raspberry Pi 3 / 3B+ ===
=== Raspberry Pi 3 / 3B+ ===


Both the AArch64 and ARMv7 images boot out-of-the-box. Using the 64-bit AArch64 image is highly recommended, as the availability of binaries is much better and allows the use of the 64-bit instruction set.
[[NixOS_on_ARM/Raspberry_Pi_3#Board-specific_installation_notes|Raspberry Pi 3#Board-specific installation notes]]
 
For the UART console, edit <code>/extlinux/extlinux.conf</code> on the boot partition of the SD card to set <code>console=ttyS1,115200n8</code> in the kernel boot parameters, and use the following GPIO Pins with an USB-TTL connector:
<syntaxhighlight>
GND        - 3rd in top row, black cable
GPIO 14 TXD - 4th in top row, white cable
GPIO 15 RXD - 5th in top row, green cable
</syntaxhighlight>
Use <code>nix-shell -p screen --run "screen /dev/ttyUSB0 115200"</code> to connect to the console.
{{note|The mainline kernel (tested with nixos kernel 4.18.7) [https://github.com/raspberrypi/linux/wiki/Upstreaming#downstream-drivers does not include support for cpu frequency scaling] on the Raspberry Pi. To get higher clock speed, set [https://www.raspberrypi.org/documentation/configuration/config-txt/overclocking.md <code><nowiki>force_turbo=1</nowiki></code>] in <code>/boot/config.txt</code> }}
 
<syntaxhighlight lang=nix>
{
  hardware.enableRedistributableFirmware = true;
  networking.wireless.enable = true;
}
</syntaxhighlight>
 
==== HDMI output issue with kernel 5.4 (NixOS 20.03 or NixOS unstable) ====
 
(Unverified for 5.5 or 5.6)
 
Some users have reported that the 5.4 kernel "hung at Starting kernel..." {{issue|82455}}. In all cases where it was possible to investigate, it was found that the device did boot, but that the HDMI out didn't function as expected.
 
It looks like it may be a setup-dependent issue, as a 20.03 image with 5.4 was verified as working.
 
If your setup is having the issue, first report on {{issue|82455}} with the Raspberry Pi model (important to note whether it is a plus or non-plus) and the kind of display used with the HDMI out, including whether it is using adapters or not.
 
Then, you can work around the issue by configuring your system to use the 4.19 kernel (previous LTS) using one of the following tricks.
 
# Use the serial console to configure the system, and <code>nixos-rebuild boot</code> it.
# Use a 19.09 image, specify the kernel in its configuration and upgrade to 20.03
# Boot the image, poweroff blindly using a keyboard, edit on another computer <code>/home/nixos/.ssh/authorized_keys</code> from the SD to add your key file, chmod as 600, unmount, boot the Raspberry Pi and find it on your network by some means.
 
<syntaxHighlight>
{
  boot.kernelPackages = pkgs.linuxPackages_4_19;
}
</syntaxHighlight>


=== Raspberry Pi 4B ===
=== Raspberry Pi 4B ===