{ config, lib, ... }: let cfg = config.kropcloud.drives; in { options.kropcloud.drives = { hasSecondDrive = lib.mkEnableOption "Whence this VM has second drive"; secondDriveMountpoint = lib.mkOption { type = lib.types.str; default = "/mnt/nas"; description = "The mountpoint for the second drive"; }; }; config = { disko.devices = { disk = { main = { type = "disk"; device = "/dev/sda"; content = { type = "gpt"; partitions = { ESP = { type = "EF00"; size = "512M"; content = { type = "filesystem"; format = "vfat"; mountpoint = "/boot"; }; }; root = { end = "-8GB"; content = { type = "filesystem"; format = "ext4"; mountpoint = "/"; }; }; swap = { size = "100%"; content = { type = "swap"; }; }; }; }; }; secondary = lib.mkIf cfg.hasSecondDrive { type = "disk"; device = "/dev/sdb"; content = { type = "gpt"; partitions = { data = { content = { type = "filesystem"; format = "ext4"; mountpoint = "/mnt/nas"; }; }; }; }; }; }; }; }; }