rpi4: initial commit

This commit is contained in:
Serĉanto de Scio 2022-06-16 12:09:40 +10:00
parent 0e552c9a94
commit c98a6a01d9
Signed by: sercanto
GPG key ID: 7DBA9F5689EFB6AA
4 changed files with 81 additions and 3 deletions

View file

@ -0,0 +1,65 @@
# Configuration common to all Raspberry Pi 4 Model B devices
{
config,
pkgs,
lib,
...
}: {
boot = {
initrd = {
availableKernelModules = [
"usbhid"
"usb_storage"
];
};
kernelPackages = pkgs.linuxKernel.kernels.linux_rpi4; # For a Raspberry Pi 4
kernelParams = [
"cma=128M" # Many GUI programs need this, nearly all wayland applications
"8250.nr_uarts=1"
"console=ttyAMA0,115200" # the serial console broken out to the GPIO
"console=tty1"
];
loader = {
grub = {
enable = false; # NixOS wants to enable GRUB by default.
};
raspberryPi = {
enable = true;
version = 4;
};
};
tmpOnTmpfs = true;
};
# 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"];
};
};
# !!! Adding a swap file is optional, but strongly recommended!
swapDevices = [
{
device = "/swapfile";
size = 1024;
}
];
hardware = {
enableRedistributableFirmware = true; # Enable support for Pi firmware blobs
};
environment.systemPackages = with pkgs; [
libraspberrypi # Userland tools for the Raspberry Pi board
];
}

View file

@ -5,7 +5,7 @@
lib,
...
}: {
imports = [../hardware/odroid-hc4];
imports = [../hardware/raspberry_pi_4_model_B.nix];
# Comment out deployment when building the SD Image.
deployment.targetHost = "10.42.0.108";
@ -27,5 +27,5 @@
gnupg # GPL OpenPGP implementation
];
system.stateVersion = "21.05"; # The version of NixOS originally installed
system.stateVersion = "22.05"; # The version of NixOS originally installed
}

View file

@ -0,0 +1,13 @@
# SD image for ceilidh
#
# To build this image, run:
#
# nix-build '<nixpkgs/nixos>' -A config.system.build.sdImage -I \
# nixos-config=./images/sd-image_ceilidh.nix
#
# An example of how to write the image to SD card:
#
# bzcat ./result/sd-image/nixos-sd-image-20.03.1577.74a80c5a9ab-aarch64-linux.img.bz2 | sudo dd of=/dev/sdb
{...}: {
imports = [./sd-image_paidh-aarch64.nix ../hosts/ceilidh.nix];
}

View file

@ -15,7 +15,7 @@
in {
imports = [
<nixpkgs/nixos/modules/profiles/base.nix>
<nixpkgs/nixos/modules/installer/cd-dvd/sd-image.nix>
<nixpkgs/nixos/modules/installer/sd-card/sd-image.nix>
];
boot.consoleLogLevel = lib.mkDefault 7;