machines-config/nixosModules/drives/default.nix
2025-01-16 19:16:30 +01:00

67 lines
1.5 KiB
Nix

{
config,
lib,
...
}:
let
cfg = config.kropcloud.drives;
in
{
options.kropcloud.drives = {
hasSecondDrive = lib.mkEnableOption "Whence this VM has 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";
};
};
};
};
};
};
};
};
}