Jump to content

NixOS on ARM/Raspberry Pi 4: Difference between revisions

Added instructions for getting bluetooth atleast usable
(→‎Troubleshooting: Added touch screen fix)
(Added instructions for getting bluetooth atleast usable)
 
(One intermediate revision by the same user not shown)
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]].
Line 253: Line 262:
   };
   };
}
}
</nowiki>}}
=== Enabling Bluetooth ===
One might get bluetooth to work with this in the configuration file:
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
  systemd.services.btattach = {
    before = [ "bluetooth.service" ];
    after = [ "dev-ttyAMA0.device" ];
    wantedBy = [ "multi-user.target" ];
    serviceConfig = {
      ExecStart = "${pkgs.bluez}/bin/btattach -B /dev/ttyAMA0 -P bcm -S 3000000";
    };
  };
</nowiki>}}
</nowiki>}}


2

edits