85 lines
2.2 KiB
Nix
85 lines
2.2 KiB
Nix
{
|
|
pkgs,
|
|
lib,
|
|
...
|
|
}:
|
|
{
|
|
# Some packages (ahci fail... this bypasses that) https://discourse.nixos.org/t/does-pkgs-linuxpackages-rpi3-build-all-required-kernel-modules/42509
|
|
nixpkgs.overlays = [
|
|
(_final: super: {
|
|
makeModulesClosure = x: super.makeModulesClosure (x // { allowMissing = true; });
|
|
})
|
|
];
|
|
|
|
zramSwap = {
|
|
enable = true;
|
|
algorithm = "zstd";
|
|
};
|
|
|
|
image.fileName = "zero2.img";
|
|
sdImage = {
|
|
# bzip2 compression takes loads of time with emulation, skip it. Enable this if you're low on space.
|
|
compressImage = false;
|
|
|
|
extraFirmwareConfig = {
|
|
# Give up VRAM for more Free System Memory
|
|
# - Disable camera which automatically reserves 128MB VRAM
|
|
start_x = 0;
|
|
# - Reduce allocation of VRAM to 16MB minimum for non-rotated (32MB for rotated)
|
|
gpu_mem = 16;
|
|
|
|
# Configure display to 800x600 so it fits on most screens
|
|
# * See: https://elinux.org/RPi_Configuration
|
|
hdmi_group = 2;
|
|
hdmi_mode = 8;
|
|
};
|
|
};
|
|
|
|
hardware = {
|
|
enableRedistributableFirmware = lib.mkForce false;
|
|
firmware = [ pkgs.raspberrypiWirelessFirmware ]; # Keep this to make sure wifi works
|
|
i2c.enable = true;
|
|
deviceTree.filter = "bcm2837-rpi-zero*.dtb";
|
|
deviceTree.overlays = [
|
|
{
|
|
name = "enable-i2c";
|
|
dtsText = ''
|
|
/dts-v1/;
|
|
/plugin/;
|
|
/ {
|
|
compatible = "brcm,bcm2837";
|
|
fragment@0 {
|
|
target = <&i2c1>;
|
|
__overlay__ {
|
|
status = "okay";
|
|
};
|
|
};
|
|
};
|
|
'';
|
|
}
|
|
];
|
|
};
|
|
|
|
boot = {
|
|
kernelPackages = pkgs.linuxKernel.packages.linux_rpi3;
|
|
|
|
initrd.availableKernelModules = [
|
|
"xhci_pci"
|
|
"usbhid"
|
|
"usb_storage"
|
|
];
|
|
loader = {
|
|
grub.enable = false;
|
|
generic-extlinux-compatible.enable = true;
|
|
};
|
|
extraModprobeConfig = ''
|
|
options brcmfmac roamoff=1 feature_disable=0x82000
|
|
'';
|
|
|
|
# Avoids warning: mdadm: Neither MAILADDR nor PROGRAM has been set. This will cause the `mdmon` service to crash.
|
|
# See: https://github.com/NixOS/nixpkgs/issues/254807
|
|
swraid.enable = lib.mkForce false;
|
|
};
|
|
|
|
nixpkgs.hostPlatform = "aarch64-linux";
|
|
}
|