My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nomicon/infra/corenix/modules/seabios/default.nix

61 lines
1.4 KiB

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.seabios;
payloadName =
if cfg.asSecondaryPayload then "img/seabios" else "fallback/payload";
in {
options.seabios = {
enable = mkEnableOption "seabios coreboot primary payload";
withVgaBios = mkOption {
type = types.bool;
default = true;
};
asSecondaryPayload = mkOption {
type = types.bool;
default = false;
};
ps2Timeout = mkOption {
type = types.int;
default = 0;
};
seabiosConfig = mkOption {
type = types.attrsOf (types.nullOr types.str);
default = { };
};
};
config = mkIf cfg.enable {
seabios.seabiosConfig = {
CONFIG_COREBOOT = "y";
} // (lib.optionalAttrs cfg.withVgaBios {
CONFIG_VGA_COREBOOT = "y";
CONFIG_BUILD_VGABIOS = "y";
});
corenix.extraFiles = let
package =
pkgs.coreboot-payload-seabios.override { inherit (cfg) seabiosConfig; };
in {
${payloadName} = {
type = "payload";
src = "${package}/bios.bin.elf";
};
} // (optionalAttrs cfg.withVgaBios {
"vgaroms/seavgabios.bin".src = "${package}/vgabios.bin";
});
corenix.installCommands = optionalString (cfg.ps2Timeout != 0) ''
cbfstool $out/coreboot.rom add-int \
-i ${toString cfg.ps2Timeout} \
-n etc/ps2-keyboard-spinup
'';
};
}