OVMF: Reformat a bit for readability

- Use 'somePkg == null' instead of 'somePkg == false' which is more
  conventional in rest of Nixpkgs
- Use lib.optionalString where applicable
This commit is contained in:
Tuomas Tynkkynen 2018-03-14 15:52:32 +02:00
parent 1d854b479c
commit 1645011983
2 changed files with 18 additions and 19 deletions

View File

@ -1,4 +1,4 @@
{ stdenv, edk2, nasm, iasl, seabios, openssl, secureBoot ? false }:
{ stdenv, lib, edk2, nasm, iasl, seabios, openssl, secureBoot ? false }:
let
@ -36,25 +36,24 @@ stdenv.mkDerivation (edk2.setup "OvmfPkg/OvmfPkg${targetArch}.dsc" {
ln -sv "$file" .
done
${if (seabios == false) then ''
ln -sv ${src}/OvmfPkg .
'' else ''
${if seabios != null then ''
cp -r ${src}/OvmfPkg .
chmod +w OvmfPkg/Csm/Csm16
cp ${seabios}/Csm16.bin OvmfPkg/Csm/Csm16/Csm16.bin
''}
${if (secureBoot == true) then ''
ln -sv ${src}/SecurityPkg .
ln -sv ${src}/CryptoPkg .
'' else ''
''}
'';
buildPhase = if (seabios == false) then ''
build ${if secureBoot then "-DSECURE_BOOT_ENABLE=TRUE" else ""}
'' else ''
build -D CSM_ENABLE -D FD_SIZE_2MB ${if secureBoot then "-DSECURE_BOOT_ENABLE=TRUE" else ""}
ln -sv ${src}/OvmfPkg .
''}
${lib.optionalString secureBoot ''
ln -sv ${src}/SecurityPkg .
ln -sv ${src}/CryptoPkg .
''}
'';
buildPhase = if seabios == null then ''
build ${lib.optionalString secureBoot "-DSECURE_BOOT_ENABLE=TRUE"}
'' else ''
build -D CSM_ENABLE -D FD_SIZE_2MB ${lib.optionalString secureBoot "-DSECURE_BOOT_ENABLE=TRUE"}
'';
postFixup = ''

View File

@ -12589,9 +12589,9 @@ with pkgs;
qboot = callPackage ../applications/virtualization/qboot { stdenv = stdenv_32bit; };
OVMF = callPackage ../applications/virtualization/OVMF { seabios=false; openssl=null; };
OVMF-CSM = callPackage ../applications/virtualization/OVMF { openssl=null; };
#WIP: OVMF-secureBoot = callPackage ../applications/virtualization/OVMF { seabios=false; secureBoot=true; };
OVMF = callPackage ../applications/virtualization/OVMF { seabios = null; openssl = null; };
OVMF-CSM = callPackage ../applications/virtualization/OVMF { openssl = null; };
#WIP: OVMF-secureBoot = callPackage ../applications/virtualization/OVMF { seabios = null; secureBoot = true; };
seabios = callPackage ../applications/virtualization/seabios { };