nixosMod: add assertions/efi

main
Felix Stupp 1 year ago
parent 2fdd6cdf00
commit 4d0842edab
Signed by: zocker
GPG Key ID: 93E1BD26F6B02FB7

@ -1,6 +1,7 @@
{
imports = [
# files
./efi.nix
./fileSystems.nix
./mdns.nix
./nixos.nix

@ -0,0 +1,39 @@
{
config,
lib,
options,
...
}:
let
inherit (lib.strings) escapeNixString;
cfg = config.boot.loader;
fs = config.fileSystems;
efiIndicator = builtins.any (x: x) [
(cfg.grub.enable && cfg.grub.efiSupport)
(cfg.systemd-boot.enable)
];
efiMountPath = escapeNixString cfg.efi.efiSysMountPoint;
efiMount = fs.${cfg.efi.efiSysMountPoint} or null;
in
# TODO check cfg.grub.mirroredBoots as well
# TODO enable disko checks (optional i.e. when disko options are available)
{
config = lib.mkIf efiIndicator {
assertions = [
{
assertion = efiMount != null;
message = ''
There is no filesystem declaration for EFI System Partition ${efiMountPath}
'';
}
{
assertion = efiMount != null -> efiMount.fsType == "vfat";
message = ''
EFI System Partition ${efiMountPath} has not fsType "vfat"
'';
}
];
};
}
Loading…
Cancel
Save