2024-10-28 13:12:06 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
config,
|
|
|
|
...
|
|
|
|
}: let
|
2024-08-24 20:30:46 +00:00
|
|
|
cfg = config.lab.storage;
|
|
|
|
modules = [
|
|
|
|
{
|
|
|
|
config = lib.mkIf (cfg.profile == "pi") {
|
|
|
|
fileSystems."/" = {
|
|
|
|
device = "/dev/disk/by-label/NIXOS_SD";
|
|
|
|
fsType = "ext4";
|
2024-10-28 13:12:06 +00:00
|
|
|
options = ["noatime"];
|
2024-08-24 20:30:46 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
2024-05-18 21:32:58 +00:00
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
{
|
|
|
|
config = lib.mkIf (cfg.profile == "kubernetes") {
|
|
|
|
disko.devices = {
|
|
|
|
disk = {
|
|
|
|
nvme = {
|
|
|
|
device = "/dev/nvme0n1";
|
|
|
|
type = "disk";
|
2024-05-18 21:32:58 +00:00
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
content = {
|
|
|
|
type = "gpt";
|
|
|
|
|
|
|
|
partitions = {
|
|
|
|
boot = {
|
|
|
|
type = "EF00";
|
|
|
|
size = "500M";
|
|
|
|
|
|
|
|
content = {
|
|
|
|
type = "filesystem";
|
|
|
|
format = "vfat";
|
|
|
|
mountpoint = "/boot";
|
|
|
|
};
|
|
|
|
};
|
2024-05-18 21:32:58 +00:00
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
pv_os = {
|
|
|
|
size = "79G";
|
2024-05-18 21:32:58 +00:00
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
content = {
|
|
|
|
type = "lvm_pv";
|
|
|
|
vg = "vg_os";
|
|
|
|
};
|
2024-05-18 21:32:58 +00:00
|
|
|
};
|
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
pv_nvme_extra = {
|
|
|
|
size = "100%";
|
2024-05-18 21:32:58 +00:00
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
content = {
|
|
|
|
type = "lvm_pv";
|
|
|
|
vg = "vg_data";
|
|
|
|
};
|
2024-05-18 21:32:58 +00:00
|
|
|
};
|
|
|
|
};
|
2024-08-24 20:30:46 +00:00
|
|
|
};
|
|
|
|
};
|
2024-05-18 21:32:58 +00:00
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
sata = {
|
|
|
|
device = "/dev/sda";
|
|
|
|
type = "disk";
|
|
|
|
|
|
|
|
content = {
|
|
|
|
type = "gpt";
|
|
|
|
|
|
|
|
partitions.pv_sata = {
|
2024-05-18 21:32:58 +00:00
|
|
|
size = "100%";
|
|
|
|
|
|
|
|
content = {
|
|
|
|
type = "lvm_pv";
|
|
|
|
vg = "vg_data";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
lvm_vg = {
|
|
|
|
vg_os = {
|
|
|
|
type = "lvm_vg";
|
2024-05-18 21:32:58 +00:00
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
lvs = {
|
|
|
|
root = {
|
|
|
|
size = "75G";
|
2024-05-18 21:32:58 +00:00
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
content = {
|
|
|
|
type = "filesystem";
|
|
|
|
format = "ext4";
|
|
|
|
mountpoint = "/";
|
2024-10-28 13:12:06 +00:00
|
|
|
mountOptions = ["defaults"];
|
2024-08-24 20:30:46 +00:00
|
|
|
};
|
|
|
|
};
|
2024-05-18 21:32:58 +00:00
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
swap = {
|
|
|
|
size = "100%FREE";
|
|
|
|
content.type = "swap";
|
2024-05-18 21:32:58 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-01-06 23:22:44 +00:00
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
vg_data = {
|
|
|
|
type = "lvm_vg";
|
2024-05-18 21:32:58 +00:00
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
lvs.longhorn = {
|
|
|
|
size = "100%FREE";
|
2024-05-18 21:32:58 +00:00
|
|
|
|
|
|
|
content = {
|
|
|
|
type = "filesystem";
|
2024-08-24 20:30:46 +00:00
|
|
|
format = "xfs";
|
|
|
|
mountpoint = "/mnt/longhorn";
|
2024-05-18 21:32:58 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-08-24 20:30:46 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
2024-05-18 21:32:58 +00:00
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
{
|
|
|
|
config = lib.mkIf (cfg.profile == "normal") {
|
|
|
|
disko.devices = {
|
|
|
|
disk.sata = {
|
|
|
|
device = "/dev/sda";
|
|
|
|
type = "disk";
|
2024-05-18 21:32:58 +00:00
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
content = {
|
|
|
|
type = "gpt";
|
2024-05-18 21:32:58 +00:00
|
|
|
|
2024-08-24 20:30:46 +00:00
|
|
|
partitions = {
|
|
|
|
boot = {
|
|
|
|
type = "EF00";
|
|
|
|
size = "500M";
|
|
|
|
|
|
|
|
content = {
|
|
|
|
type = "filesystem";
|
|
|
|
format = "vfat";
|
|
|
|
mountpoint = "/boot";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
root = {
|
|
|
|
size = "100%";
|
|
|
|
|
|
|
|
content = {
|
|
|
|
type = "filesystem";
|
|
|
|
format = "ext4";
|
|
|
|
mountpoint = "/";
|
2024-10-28 13:12:06 +00:00
|
|
|
mountOptions = ["defaults"];
|
2024-08-24 20:30:46 +00:00
|
|
|
};
|
|
|
|
};
|
2024-05-18 21:32:58 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-08-24 20:30:46 +00:00
|
|
|
}
|
|
|
|
];
|
2024-10-28 13:12:06 +00:00
|
|
|
in {
|
2024-08-24 20:30:46 +00:00
|
|
|
imports = modules;
|
|
|
|
|
|
|
|
options.lab.storage = {
|
|
|
|
profile = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
2024-05-26 12:34:19 +00:00
|
|
|
};
|
2024-01-06 23:22:44 +00:00
|
|
|
};
|
|
|
|
}
|