2 # nix-build nixos -I nixos-config=nixos/modules/installer/sd-card/sd-image-raspberrypi.nix -A config.system.build.sdImage
3 { config, lib, pkgs, ... }:
7 ../../profiles/base.nix
11 boot.loader.grub.enable = false;
12 boot.loader.generic-extlinux-compatible.enable = true;
14 boot.consoleLogLevel = lib.mkDefault 7;
15 boot.kernelPackages = pkgs.linuxKernel.packages.linux_rpi1;
18 populateFirmwareCommands = let
19 configTxt = pkgs.writeText "config.txt" ''
20 # Prevent the firmware from smashing the framebuffer setup done by the mainline kernel
21 # when attempting to show low-voltage or overtemperature warnings.
25 kernel=u-boot-rpi0.bin
28 kernel=u-boot-rpi1.bin
31 (cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
32 cp ${pkgs.ubootRaspberryPiZero}/u-boot.bin firmware/u-boot-rpi0.bin
33 cp ${pkgs.ubootRaspberryPi}/u-boot.bin firmware/u-boot-rpi1.bin
34 cp ${configTxt} firmware/config.txt
36 populateRootCommands = ''
38 ${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot