Jump to content

NixOS on ARM/Raspberry Pi 4: Difference between revisions

m
Added instructions for audio through hdmi and fixed a typo in spi section
(→‎Troubleshooting: Added touch screen fix)
m (Added instructions for audio through hdmi and fixed a typo in spi section)
Tags: Mobile edit Mobile web edit
Line 138: Line 138:
   hardware.pulseaudio.enable = true;
   hardware.pulseaudio.enable = true;
   hardware.raspberry-pi."4".audio.enable = true;
   hardware.raspberry-pi."4".audio.enable = true;
</nowiki>}}
For audio through hdmi:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
  sound.enable = true;
  hardware.pulseaudio.enable = true;
  boot.kernelParams = [
"snd_bcm2835.enable_hdmi=1"];
</nowiki>}}
</nowiki>}}


Line 173: Line 182:


To enable the SPI, you would normally add <code>dtparam=spi=on</code> to <code>/boot/config.txt</code>.
To enable the SPI, you would normally add <code>dtparam=spi=on</code> to <code>/boot/config.txt</code>.
This is not possbible on NixOS, and instead you have to apply a device tree overlay.
This is not possible on NixOS, and instead you have to apply a device tree overlay.
For this we use the <code>hardware.deviceTree.overlays</code> option.
For this we use the <code>hardware.deviceTree.overlays</code> option.
After applying the overlay, we add an <code>spi</code> group and change the owner of the <code>spidev</code> device to it, similarly to [[#Using GPIO pins as non root |GPIO]].
After applying the overlay, we add an <code>spi</code> group and change the owner of the <code>spidev</code> device to it, similarly to [[#Using GPIO pins as non root |GPIO]].
2

edits