1# To build, use:
2# nix-build nixos -I nixos-config=nixos/modules/installer/sd-card/sd-image-riscv64-qemu.nix -A config.system.build.sdImage
3{
4 config,
5 lib,
6 pkgs,
7 ...
8}:
9
10{
11 imports = [
12 ../../profiles/base.nix
13 ./sd-image.nix
14 ];
15
16 boot.loader = {
17 grub.enable = false;
18 generic-extlinux-compatible = {
19 enable = true;
20
21 # Don't even specify FDTDIR - We do not have the correct DT
22 # The DTB is generated by QEMU at runtime
23 useGenerationDeviceTree = false;
24 };
25 };
26
27 boot.consoleLogLevel = lib.mkDefault 7;
28 boot.kernelParams = [
29 "console=tty0"
30 "console=ttyS0,115200n8"
31 ];
32
33 sdImage = {
34 populateFirmwareCommands = "";
35 populateRootCommands = ''
36 mkdir -p ./files/boot
37 ${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot
38 '';
39 };
40}