NixOS on ARM/Raspberry Pi 4: Difference between revisions
imported>Samueldr Init page, spinned-off from the main one |
imported>Samueldr m Add minimal configuration sample |
||
| Line 41: | Line 41: | ||
First follow the [[NixOS_on_ARM#Installation|generic installation steps]] to get the installer image and install using the [[NixOS_on_ARM#NixOS_installation_.26_configuration|installation and configuration steps]]. | First follow the [[NixOS_on_ARM#Installation|generic installation steps]] to get the installer image and install using the [[NixOS_on_ARM#NixOS_installation_.26_configuration|installation and configuration steps]]. | ||
Support for the Pi 4 in nixpkgs is still experimental. These configurations will boot (from [https://github.com/NixOS/nixpkgs/pull/68265#issuecomment-532040372 this PR comment]): | |||
Until the generic image works, a [https://hydra.nixos.org/job/nixos/trunk-combined/nixos.sd_image_raspberrypi4.aarch64-linux temporary device-specific image is build on Hydra]. Note that this image is not using u-boot, but rather the Raspberry Pi specific bootloader configuration. | |||
=== Minimal configuration === | |||
Using <code>nixos-generate-config</code> will not generate the required minimal configuration. | |||
=== GPU support === | |||
The following configuration samples are built on the assumption that they are added to | The following configuration samples are built on the assumption that they are added to an already working configuration. They are not complete configurations. | ||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | {{file|/etc/nixos/configuration.nix|nix|<nowiki> | ||
{ pkgs, ... }: | { pkgs, ... }: | ||
{ | { | ||
# Assuming this is installed on top of the disk image. | |||
fileSystems = { | |||
"/boot" = { | |||
device = "/dev/disk/by-label/NIXOS_BOOT"; | |||
fsType = "vfat"; | |||
}; | |||
"/" = { | |||
device = "/dev/disk/by-label/NIXOS_SD"; | |||
fsType = "ext4"; | |||
}; | |||
}; | |||
boot.loader.grub.enable = false; | |||
boot.loader.raspberryPi.enable = true; | |||
boot.loader.raspberryPi.version = 4; | |||
# Mainline doesn't work yet | |||
boot.kernelPackages = pkgs.linuxPackages_rpi4; | |||
# ttyAMA0 is the serial console broken out to the GPIO | |||
boot.kernelParams = [ | |||
"console=ttyAMA0,115200" | |||
"console=tty1" | |||
]; | |||
# Required for the Wireless firmware | |||
hardware.enableRedistributableFirmware = true; | |||
} | |||
</nowiki>}} | |||
==== Without GPU ==== | |||
{{file|/etc/nixos/configuration.nix|nix|<nowiki> | |||
{ | |||
services.xserver = { | services.xserver = { | ||
enable = true; | enable = true; | ||
| Line 69: | Line 99: | ||
{ | { | ||
hardware.opengl = { | hardware.opengl = { | ||
enable = true; | enable = true; | ||
| Line 85: | Line 114: | ||
videoDrivers = [ "modesetting" ]; | videoDrivers = [ "modesetting" ]; | ||
}; | }; | ||
boot.loader.raspberryPi.firmwareConfig = '' | boot.loader.raspberryPi.firmwareConfig = '' | ||
gpu_mem=192 | gpu_mem=192 | ||