NixOS on ARM/Raspberry Pi 4: Difference between revisions
Adjust to correct SPI device tree options |
undo accidental chinese translation Tags: Manual revert Visual edit |
||
(16 intermediate revisions by 4 users not shown) | |||
Line 47: | Line 47: | ||
Using <code>nixos-generate-config</code> will generate the required minimal configuration. | Using <code>nixos-generate-config</code> will generate the required minimal configuration. | ||
Raspberry Pi 4 is well-supported on modern kernels. However, if you encounter issues with GPU support or other deviceTree quirks, you may wish to add the nixos-hardware channel: | |||
<code> | <code> | ||
Line 75: | Line 75: | ||
raspberrypi-eeprom | raspberrypi-eeprom | ||
]; | ]; | ||
system.stateVersion = " | system.stateVersion = "24.11"; | ||
} | } | ||
</nowiki>}} | </nowiki>}} | ||
=== USB boot === | === USB boot === | ||
Line 135: | Line 136: | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
{ | |||
# Enable audio devices | |||
boot.kernelParams = [ "snd_bcm2835.enable_hdmi=1" "snd_bcm2835.enable_headphones=1" ]; | |||
boot.loader.raspberryPi.firmwareConfig = '' | |||
dtparam=audio=on | |||
''; | |||
} | |||
</nowiki>}} | </nowiki>}} | ||
For | If you're running headless, you can also disable HDMI audio and force use of the headphones jack by adding <code>hdmi_ignore_edid_audio=1</code> on a line below <code>dtparam=audio=on</code>. | ||
=== Networking === | |||
Ethernet and wifi interfaces should work out of the box. In addition to normal network configuration, consider disabling wifi powersaving if you experience slowness or issues with the host becoming unreachable on the network shortly after boot. For NetworkManager, the following configuration is sufficient: | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
{ | |||
# Basic networking | |||
networking.networkmanager.enable = true; | |||
# Prevent host becoming unreachable on wifi after some time. | |||
networking.networkmanager.wifi.powersave = false; | |||
} | |||
</nowiki>}} | </nowiki>}} | ||
Line 277: | Line 288: | ||
}; | }; | ||
</nowiki>}} | </nowiki>}} | ||
== Customizing & Generating SD image without installation step == | |||
There's a nix-community project to support fine-grained kernel & config.txt, and generate the image directly: | |||
[https://github.com/nix-community/raspberry-pi-nix/ nix-community/raspberry-pi-nix] | |||
== Notes about the boot process == | == Notes about the boot process == |