From 2cb7743e9c0f5c525c33ae2bccc7af30aefd97f0 Mon Sep 17 00:00:00 2001 From: Zhaofeng Li Date: Sat, 16 Oct 2021 08:58:04 -0700 Subject: [PATCH] sd-image-x86_64: init --- .../sd-card/sd-image-riscv64-qemu.nix | 2 +- .../installer/sd-card/sd-image-x86_64.nix | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 nixos/modules/installer/sd-card/sd-image-x86_64.nix diff --git a/nixos/modules/installer/sd-card/sd-image-riscv64-qemu.nix b/nixos/modules/installer/sd-card/sd-image-riscv64-qemu.nix index bd2722af8ab8..a3e30768da45 100644 --- a/nixos/modules/installer/sd-card/sd-image-riscv64-qemu.nix +++ b/nixos/modules/installer/sd-card/sd-image-riscv64-qemu.nix @@ -20,7 +20,7 @@ }; boot.consoleLogLevel = lib.mkDefault 7; - boot.kernelParams = ["console=tty0" "console=ttyS0,115200n8"]; + boot.kernelParams = [ "console=tty0" "console=ttyS0,115200n8" ]; sdImage = { populateFirmwareCommands = ""; diff --git a/nixos/modules/installer/sd-card/sd-image-x86_64.nix b/nixos/modules/installer/sd-card/sd-image-x86_64.nix new file mode 100644 index 000000000000..b44c0a4eeca5 --- /dev/null +++ b/nixos/modules/installer/sd-card/sd-image-x86_64.nix @@ -0,0 +1,27 @@ +# To build, use: +# nix-build nixos -I nixos-config=nixos/modules/installer/sd-card/sd-image-x86_64.nix -A config.system.build.sdImage + +# This image is primarily used in NixOS tests (boot.nix) to test `boot.loader.generic-extlinux-compatible`. +{ config, lib, pkgs, ... }: + +{ + imports = [ + ../../profiles/base.nix + ./sd-image.nix + ]; + + boot.loader = { + grub.enable = false; + generic-extlinux-compatible.enable = true; + }; + + boot.consoleLogLevel = lib.mkDefault 7; + + sdImage = { + populateFirmwareCommands = ""; + populateRootCommands = '' + mkdir -p ./files/boot + ${config.boot.loader.generic-extlinux-compatible.populateCmd} -c ${config.system.build.toplevel} -d ./files/boot + ''; + }; +}