Skip to content

Instantly share code, notes, and snippets.

@voidcontext
Created December 15, 2019 15:24
Show Gist options
  • Save voidcontext/e703210cb353cc7a74c90a2a06d2a669 to your computer and use it in GitHub Desktop.
Save voidcontext/e703210cb353cc7a74c90a2a06d2a669 to your computer and use it in GitHub Desktop.
Default RPi Nixos Config template
{ config, pkgs, lib, ... }:
{
# NixOS wants to enable GRUB by default
boot.loader.grub.enable = false;
# Enables the generation of /boot/extlinux/extlinux.conf
boot.loader.generic-extlinux-compatible.enable = true;
# !!! If your board is a Raspberry Pi 1, select this:
boot.kernelPackages = pkgs.linuxPackages_rpi;
# !!! Otherwise (even if you have a Raspberry Pi 2 or 3), pick this:
boot.kernelPackages = pkgs.linuxPackages_latest;
# !!! This is only for ARMv6 / ARMv7. Don't enable this on AArch64, cache.nixos.org works there.
nix.binaryCaches = lib.mkForce [ "http://nixos-arm.dezgeg.me/channel" ];
nix.binaryCachePublicKeys = [ "nixos-arm.dezgeg.me-1:xBaUKS3n17BZPKeyxL4JfbTqECsT+ysbDJz29kLFRW0=%" ];
# !!! Needed for the virtual console to work on the RPi 3, as the default of 16M doesn't seem to be enough.
# If X.org behaves weirdly (I only saw the cursor) then try increasing this to 256M.
# On a Raspberry Pi 4 with 4 GB, you should either disable this parameter or increase to at least 64M if you want the USB ports to work.
boot.kernelParams = ["cma=32M"];
# File systems configuration for using the installer's partition layout
fileSystems = {
"/boot" = {
device = "/dev/disk/by-label/NIXOS_BOOT";
fsType = "vfat";
};
"/" = {
device = "/dev/disk/by-label/NIXOS_SD";
fsType = "ext4";
};
};
# !!! Adding a swap file is optional, but strongly recommended!
# swapDevices = [ { device = "/swapfile"; size = 1024; } ];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment