41 lines
1.2 KiB
Nix
41 lines
1.2 KiB
Nix
# Base image for building SD images for my Pi 2's
|
|
#
|
|
# To build, use:
|
|
# imports = [ ./sd-image_paidh-armv7.nix ]
|
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
let
|
|
extlinux-conf-builder =
|
|
import <nixpkgs/nixos/modules/system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.nix> {
|
|
pkgs = pkgs.buildPackages;
|
|
};
|
|
in
|
|
{
|
|
imports = [
|
|
<nixpkgs/nixos/modules/profiles/base.nix>
|
|
<nixpkgs/nixos/modules/installer/cd-dvd/sd-image-armv7l-multiplatform.nix>
|
|
];
|
|
|
|
boot.consoleLogLevel = lib.mkDefault 7;
|
|
|
|
sdImage = {
|
|
populateFirmwareCommands = let
|
|
configTxt = pkgs.writeText "config.txt" ''
|
|
# Prevent the firmware from smashing the framebuffer setup done by the mainline kernel
|
|
# when attempting to show low-voltage or overtemperature warnings.
|
|
avoid_warnings=1
|
|
'';
|
|
in ''
|
|
(cd ${pkgs.raspberrypifw}/share/raspberrypi/boot && cp bootcode.bin fixup*.dat start*.elf $NIX_BUILD_TOP/firmware/)
|
|
cp ${pkgs.ubootRaspberryPi2}/u-boot.bin firmware/u-boot-rpi2.bin
|
|
cp ${configTxt} firmware/config.txt
|
|
'';
|
|
populateRootCommands = ''
|
|
mkdir -p ./files/boot
|
|
${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./files/boot
|
|
'';
|
|
};
|
|
|
|
}
|