1{ config, lib, pkgs, ... }:
2
3let
4 extlinux-conf-builder =
5 import ../../system/boot/loader/generic-extlinux-compatible/extlinux-conf-builder.nix {
6 inherit pkgs;
7 };
8in
9{
10 imports = [
11 ../../profiles/minimal.nix
12 ../../profiles/installation-device.nix
13 ./sd-image.nix
14 ];
15
16 assertions = lib.singleton {
17 assertion = pkgs.stdenv.system == "armv6l-linux";
18 message = "sd-image-raspberrypi.nix can be only built natively on ARMv6; " +
19 "it cannot be cross compiled";
20 };
21
22 # Needed by RPi firmware
23 nixpkgs.config.allowUnfree = true;
24
25 boot.loader.grub.enable = false;
26 boot.loader.generic-extlinux-compatible.enable = true;
27
28 boot.kernelPackages = pkgs.linuxPackages_rpi;
29 boot.consoleLogLevel = 7;
30
31 # FIXME: this probably should be in installation-device.nix
32 users.extraUsers.root.initialHashedPassword = "";
33
34 sdImage = {
35 populateBootCommands = ''
36 for f in bootcode.bin fixup.dat start.elf; do
37 cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/$f boot/
38 done
39 cp ${pkgs.ubootRaspberryPi}/u-boot.bin boot/u-boot-rpi.bin
40 echo 'kernel u-boot-rpi.bin' > boot/config.txt
41 ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./boot
42 '';
43 };
44}