diff options
Diffstat (limited to 'sys/boot/efi.nix')
| -rw-r--r-- | sys/boot/efi.nix | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/sys/boot/efi.nix b/sys/boot/efi.nix new file mode 100644 index 0000000..35cf687 --- /dev/null +++ b/sys/boot/efi.nix @@ -0,0 +1,35 @@ +{ config, lib, ... }: +with lib; let + cfg = config.local.boot.efi; +in +{ + options.local.boot.efi = { + enable = mkEnableOption "EFI with FAT32 system partition"; + + esp.uuid = mkOption { + type = types.strMatching "[0-9A-F]{4}-[0-9A-F]{4}"; + }; + + removable = mkOption { + type = types.bool; + }; + }; + + config = mkIf cfg.enable { + boot = { + initrd.supportedFilesystems = [ "vfat" ]; + + loader = { + efi.canTouchEfiVariables = !cfg.removable; + grub.efiInstallAsRemovable = cfg.removable; + }; + }; + + fileSystems."/boot" = { + device = "/dev/disk/by-uuid/${cfg.esp.uuid}"; + fsType = "vfat"; + options = [ "noatime" "umask=027" "sync" ]; + neededForBoot = true; + }; + }; +} |
