2024-12-20 10:03:05 +01:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
cfg = config.kropcloud.drives;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.kropcloud.drives = {
|
|
|
|
hasSecondDrive = lib.mkEnableOption "Whence this VM has second drive";
|
2025-01-16 19:47:49 +01:00
|
|
|
secondDriveMountpoint = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
default = "/mnt/nas";
|
|
|
|
description = "The mountpoint for the second drive";
|
|
|
|
};
|
2024-12-20 10:03:05 +01:00
|
|
|
};
|
|
|
|
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";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2025-01-16 19:16:30 +01:00
|
|
|
secondary = lib.mkIf cfg.hasSecondDrive {
|
|
|
|
type = "disk";
|
|
|
|
device = "/dev/sdb";
|
|
|
|
content = {
|
|
|
|
type = "gpt";
|
|
|
|
partitions = {
|
|
|
|
data = {
|
|
|
|
content = {
|
|
|
|
type = "filesystem";
|
|
|
|
format = "ext4";
|
|
|
|
mountpoint = "/mnt/nas";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-12-20 10:03:05 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|