mio-ops/hardware/raspberry_pi_2_model_B.nix

83 lines
2.1 KiB
Nix
Raw Normal View History

2020-09-18 12:56:00 +00:00
# Configuration common to all Raspberry Pi 2 Model B devices
2020-06-25 22:51:29 +00:00
{ config, pkgs, lib, ... }:
{
boot = {
2020-09-18 12:56:00 +00:00
consoleLogLevel = lib.mkDefault 7;
2020-06-25 22:51:29 +00:00
initrd = {
availableKernelModules = [
2021-11-16 04:57:23 +00:00
"bcm2835_dma" # Allows early (earlier) mode setting
"i2c_bcm2835" # Allows early (earlier) mode setting
2020-06-25 22:51:29 +00:00
"usbhid"
"usb_storage"
2021-11-16 04:57:23 +00:00
"vc4" # Allows early (earlier) mode setting
2020-06-25 22:51:29 +00:00
];
};
2021-11-16 04:57:23 +00:00
kernelPackages = pkgs.linuxPackages_latest; # For a Raspberry Pi 2 or 3)
2020-06-25 22:51:29 +00:00
kernelParams = [
2021-11-16 04:57:23 +00:00
"console=ttyS0,115200n8" # Enable the serial console
2020-06-25 22:51:29 +00:00
"console=ttyAMA0,115200n8"
"console=tty0"
];
loader = {
generic-extlinux-compatible = {
2021-11-16 04:57:23 +00:00
enable = true; # Enables the generation of /boot/extlinux/extlinux.conf
2020-06-25 22:51:29 +00:00
};
grub = {
2021-11-16 04:57:23 +00:00
enable = false; # NixOS wants to enable GRUB by default.
2020-06-25 22:51:29 +00:00
};
raspberryPi = {
enable = true;
version = 3;
firmwareConfig = ''
hdmi_force_hotplug=1 # Enable headless booting
'';
};
};
};
# File systems configuration for using the installer's partition layout
fileSystems = {
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
"/boot/firmware" = {
device = "/dev/disk/by-label/FIRMWARE";
fsType = "vfat";
# Alternatively, this could be removed from the configuration.
# The filesystem is not needed at runtime, it could be treated
# as an opaque blob instead of a discrete FAT32 filesystem.
options = [ "nofail" "noauto" ];
};
"/var" = {
device = "/dev/disk/by-label/var";
fsType = "ext4";
};
};
# !!! Adding a swap file is optional, but strongly recommended!
2021-11-16 04:57:23 +00:00
swapDevices = [{
device = "/swapfile";
size = 1024;
}];
2020-06-25 22:51:29 +00:00
hardware = {
2021-11-16 04:57:23 +00:00
enableRedistributableFirmware = true; # Enable support for Pi firmware blobs
2020-06-25 22:51:29 +00:00
};
networking = {
2021-11-16 04:57:23 +00:00
enableB43Firmware = false; # If true, enable Pi wireless firmware
2020-06-25 22:51:29 +00:00
};
2021-11-16 04:57:23 +00:00
sound.enable = false; # Disable sound.
2020-09-18 12:56:00 +00:00
2021-11-16 04:57:23 +00:00
environment.systemPackages = with pkgs;
[
libraspberrypi # Userland tools for the Raspberry Pi board
];
2020-06-25 22:51:29 +00:00
}