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
30 # FIXME: fix manual evaluation on ARM
31 services.nixosManual.enable = lib.mkOverride 0 false;
32
33 # FIXME: this probably should be in installation-device.nix
34 users.extraUsers.root.initialHashedPassword = "";
35
36 sdImage = {
37 populateBootCommands = ''
38 for f in bootcode.bin fixup.dat start.elf; do
39 cp ${pkgs.raspberrypifw}/share/raspberrypi/boot/$f boot/
40 done
41 cp ${pkgs.ubootRaspberryPi}/u-boot.bin boot/u-boot-rpi.bin
42 echo 'kernel u-boot-rpi.bin' > boot/config.txt
43 ${extlinux-conf-builder} -t 3 -c ${config.system.build.toplevel} -d ./boot
44 '';
45 };
46}