NixOS on ARM/Raspberry Pi 5: Difference between revisions
m migrate templates |
m migrate templates |
||
| Line 91: | Line 91: | ||
=== Step 2: Installing NixOS === | === Step 2: Installing NixOS === | ||
Once you're running an installer image, you can create a flake referencing the repository. For example:{{File| | Once you're running an installer image, you can create a flake referencing the repository. For example:{{File|3={ | ||
description = "Example Raspberry Pi 5 configuration flake"; | description = "Example Raspberry Pi 5 configuration flake"; | ||
inputs = { | inputs = { | ||
| Line 155: | Line 155: | ||
}; | }; | ||
}; | }; | ||
<nowiki>}</nowiki> | <nowiki>}</nowiki>|name=flake.nix|lang=nix}}Finally, simply <code>nixos-rebuild switch --flake .#yourHostname</code> the flake. | ||
}}Finally, simply <code>nixos-rebuild switch --flake .#yourHostname</code> the flake. | |||
== Other Solutions == | == Other Solutions == | ||
| Line 254: | Line 253: | ||
EDK2 enables booting a mainline kernel, but hardware support will be very limited. Notably, you'll need to perform the installation using Wi-Fi, as Ethernet is unsupported. Once the system is installed, you can switch to the vendor's modified kernel. This is not (yet?) available in Nixpkgs, so you'll need to get it from [https://gitlab.com/vriska/nix-rpi5 a flake]. If you're not using flakes, you can simply add this to your configuration: | EDK2 enables booting a mainline kernel, but hardware support will be very limited. Notably, you'll need to perform the installation using Wi-Fi, as Ethernet is unsupported. Once the system is installed, you can switch to the vendor's modified kernel. This is not (yet?) available in Nixpkgs, so you'll need to get it from [https://gitlab.com/vriska/nix-rpi5 a flake]. If you're not using flakes, you can simply add this to your configuration: | ||
{{file| | {{file|3=<nowiki> | ||
{ | { | ||
boot.kernelPackages = (import (builtins.fetchTarball https://gitlab.com/vriska/nix-rpi5/-/archive/main.tar.gz)).legacyPackages.aarch64-linux.linuxPackages_rpi5; | boot.kernelPackages = (import (builtins.fetchTarball https://gitlab.com/vriska/nix-rpi5/-/archive/main.tar.gz)).legacyPackages.aarch64-linux.linuxPackages_rpi5; | ||
} | } | ||
</nowiki>}} | </nowiki>|name=configuration.nix|lang=nix}} | ||
For the vendor kernel to boot properly, you must switch from ACPI to Device Tree in the UEFI settings (at Device Manager → Raspberry Pi Configuration → ACPI / Device Tree → System Table Mode). When using the vendor kernel (which provides full power management support), you may additionally wish to remove <code>force_turbo=1</code> from <code>/boot/config.txt</code>. | For the vendor kernel to boot properly, you must switch from ACPI to Device Tree in the UEFI settings (at Device Manager → Raspberry Pi Configuration → ACPI / Device Tree → System Table Mode). When using the vendor kernel (which provides full power management support), you may additionally wish to remove <code>force_turbo=1</code> from <code>/boot/config.txt</code>. | ||
If you are using nixos-unstable, then you can also use the rpi4 kernel (which is a generic aarch64 kernel for Pi 3 and later models). Although, due to a smaller page size, this will have slightly worse performance: | If you are using nixos-unstable, then you can also use the rpi4 kernel (which is a generic aarch64 kernel for Pi 3 and later models). Although, due to a smaller page size, this will have slightly worse performance: | ||
{{file| | {{file|||<nowiki> | ||
{ | { | ||
boot.kernelPackages = pkgs.linuxPackages_rpi4; | boot.kernelPackages = pkgs.linuxPackages_rpi4; | ||
} | } | ||
</nowiki>}} | </nowiki>|name=configuration.nix|lang=nix}} | ||
==== Troubleshooting ==== | ==== Troubleshooting ==== | ||
| Line 278: | Line 277: | ||
===== Bluetooth ===== | ===== Bluetooth ===== | ||
If your Bluetooth doesn't show up, and you are getting errors in dmesg regarding the serial port at 107050c00, add the following to your NixOS configuration:{{file| | If your Bluetooth doesn't show up, and you are getting errors in dmesg regarding the serial port at 107050c00, add the following to your NixOS configuration:{{file|||<nowiki> | ||
{ | { | ||
boot.kernelParams = [ "8250.nr_uarts=11" "console=ttyAMA10,9600" "console=tty0"]; | boot.kernelParams = [ "8250.nr_uarts=11" "console=ttyAMA10,9600" "console=tty0"]; | ||
} | } | ||
</nowiki>}} | </nowiki>|name=configuration.nix|lang=nix}} | ||
==== Using the Pi 5 as a remote builder to build native ARM packages for the Pi 5 ==== | ==== Using the Pi 5 as a remote builder to build native ARM packages for the Pi 5 ==== | ||