about summary refs log tree commit diff
path: root/nixos/modules/virtualisation
diff options
context:
space:
mode:
authorYang, Bo <yang-bo@yang-bo.com>2023-11-07 10:59:58 -0800
committerYureka <yuka@yuka.dev>2023-11-08 21:05:21 +0100
commit1ce985242c178a9fd27d11f070262ed9e5d2bece (patch)
tree345ee0ce9a0f2a69cdef894384aa23a9bd35d4bb /nixos/modules/virtualisation
parente52b59f96b04a7c87a68596ea36577460574c654 (diff)
downloadnixlib-1ce985242c178a9fd27d11f070262ed9e5d2bece.tar
nixlib-1ce985242c178a9fd27d11f070262ed9e5d2bece.tar.gz
nixlib-1ce985242c178a9fd27d11f070262ed9e5d2bece.tar.bz2
nixlib-1ce985242c178a9fd27d11f070262ed9e5d2bece.tar.lz
nixlib-1ce985242c178a9fd27d11f070262ed9e5d2bece.tar.xz
nixlib-1ce985242c178a9fd27d11f070262ed9e5d2bece.tar.zst
nixlib-1ce985242c178a9fd27d11f070262ed9e5d2bece.zip
google-compute-image: support NVMe and UEFI
Diffstat (limited to 'nixos/modules/virtualisation')
-rw-r--r--nixos/modules/virtualisation/google-compute-image.nix8
1 files changed, 8 insertions, 0 deletions
diff --git a/nixos/modules/virtualisation/google-compute-image.nix b/nixos/modules/virtualisation/google-compute-image.nix
index 197ebb18b9ad..dcdd1b59eef5 100644
--- a/nixos/modules/virtualisation/google-compute-image.nix
+++ b/nixos/modules/virtualisation/google-compute-image.nix
@@ -44,10 +44,17 @@ in
         GZIP compression level of the resulting disk image (1-9).
       '';
     };
+    virtualisation.googleComputeImage.efi = mkEnableOption "EFI booting";
   };
 
   #### implementation
   config = {
+    boot.initrd.availableKernelModules = [ "nvme" ];
+    boot.loader.grub = mkIf cfg.efi {
+      device = mkForce "nodev";
+      efiSupport = true;
+      efiInstallAsRemovable = true;
+    };
 
     system.build.googleComputeImage = import ../../lib/make-disk-image.nix {
       name = "google-compute-image";
@@ -62,6 +69,7 @@ in
       '';
       format = "raw";
       configFile = if cfg.configFile == null then defaultConfigFile else cfg.configFile;
+      partitionTableType = if cfg.efi then "efi" else "legacy";
       inherit (cfg) diskSize;
       inherit config lib pkgs;
     };