diff --git a/hardware/raspberry_pi_4_model_B.nix b/hardware/raspberry_pi_4_model_B.nix new file mode 100644 index 0000000..9fe278d --- /dev/null +++ b/hardware/raspberry_pi_4_model_B.nix @@ -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 + ]; +} diff --git a/hosts/ceilidh.nix b/hosts/ceilidh.nix index 93ad9fb..327c188 100644 --- a/hosts/ceilidh.nix +++ b/hosts/ceilidh.nix @@ -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 } diff --git a/images/sd-image_ceilidh.nix b/images/sd-image_ceilidh.nix new file mode 100644 index 0000000..2838281 --- /dev/null +++ b/images/sd-image_ceilidh.nix @@ -0,0 +1,13 @@ +# SD image for ceilidh +# +# To build this image, run: +# +# nix-build '' -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]; +} diff --git a/images/sd-image_paidh-aarch64.nix b/images/sd-image_paidh-aarch64.nix index 1d63ef1..4f7fd9b 100644 --- a/images/sd-image_paidh-aarch64.nix +++ b/images/sd-image_paidh-aarch64.nix @@ -15,7 +15,7 @@ in { imports = [ - + ]; boot.consoleLogLevel = lib.mkDefault 7;