summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnderson Torres <torres.anderson.85@protonmail.com>2024-09-30 12:35:00 -0300
committerAnderson Torres <torres.anderson.85@protonmail.com>2024-10-02 19:38:11 -0300
commit525eebaa3d30267cc52e5f8b731a9d5aa32d9c64 (patch)
treedd632f64b5babf38fb540cefc1d84b9cf6603734
parentseabios: use outputDoc (diff)
downloadnixpkgs-525eebaa3d30267cc52e5f8b731a9d5aa32d9c64.tar.gz
seabios: new parameter ___build-type
It can assume the values "coreboot", "csm" and "qemu". The triple-underscored kebab-cased format is a poor man's mitigation for the problem of unexpected shadowing.
-rw-r--r--pkgs/by-name/se/seabios/package.nix31
1 files changed, 27 insertions, 4 deletions
diff --git a/pkgs/by-name/se/seabios/package.nix b/pkgs/by-name/se/seabios/package.nix
index 992082babeab..0e0fc06aeb16 100644
--- a/pkgs/by-name/se/seabios/package.nix
+++ b/pkgs/by-name/se/seabios/package.nix
@@ -5,8 +5,33 @@
python3,
stdenv,
writeText,
+ # Configurable options
+ ___build-type ? "csm",
}:
+assert lib.elem (___build-type) [
+ "coreboot"
+ # SeaBIOS with CSM (Compatible Support Module) support; learn more at
+ # https://www.electronicshub.org/what-is-csm-bios/
+ "csm"
+ "qemu"
+];
+let
+ biosfile =
+ {
+ "coreboot" = "bios.bin.elf";
+ "csm" = "Csm16.bin";
+ "qemu" = "bios.bin";
+ }
+ .${___build-type};
+ configuration-string =
+ {
+ "coreboot" = "CONFIG_COREBOOT";
+ "csm" = "CONFIG_CSM";
+ "qemu" = "CONFIG_QEMU";
+ }
+ .${___build-type};
+in
stdenv.mkDerivation (finalAttrs: {
pname = "seabios";
version = "1.16.3";
@@ -43,9 +68,7 @@ stdenv.mkDerivation (finalAttrs: {
let
config = writeText "config.txt" (
lib.generators.toKeyValue { } {
- # SeaBIOS with CSM (Compatible Support Module) support; learn more at
- # https://www.electronicshub.org/what-is-csm-bios/
- "CONFIG_CSM" = "y";
+ "${configuration-string}" = "y";
"CONFIG_PERMIT_UNALIGNED_PCIROM" = "y";
"CONFIG_QEMU_HARDWARE" = "y";
}
@@ -61,7 +84,7 @@ stdenv.mkDerivation (finalAttrs: {
mkdir -pv ''${!outputDoc}/share/doc/seabios-${finalAttrs.version}/
cp -v docs/* ''${!outputDoc}/share/doc/seabios-${finalAttrs.version}/
- install -Dm644 out/Csm16.bin -t $out/share/seabios/
+ install -Dm644 out/${biosfile} -t $out/share/seabios/
runHook postInstall
'';