2024-01-28 10:48:13 +00:00
|
|
|
{ lib, config, machine, ... }:
|
2024-01-06 23:22:44 +00:00
|
|
|
let cfg = config.lab.storage;
|
|
|
|
in {
|
|
|
|
options.lab.storage = {
|
|
|
|
osDisk = lib.mkOption {
|
2024-02-29 19:59:48 +00:00
|
|
|
type = with lib.types; nullOr str;
|
2024-01-06 23:22:44 +00:00
|
|
|
description = ''
|
|
|
|
The disk to be used for the machine's operating system.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2024-02-27 22:28:52 +00:00
|
|
|
config = {
|
2024-05-26 12:34:19 +00:00
|
|
|
fileSystems."/" = lib.mkIf machine.isRaspberryPi {
|
|
|
|
device = "/dev/disk/by-label/NIXOS_SD";
|
|
|
|
fsType = "ext4";
|
|
|
|
options = [ "noatime" ];
|
|
|
|
};
|
2024-05-18 21:32:58 +00:00
|
|
|
|
2024-05-26 12:34:19 +00:00
|
|
|
disko = lib.mkIf (! machine.isRaspberryPi) {
|
2024-05-18 21:32:58 +00:00
|
|
|
devices = {
|
|
|
|
disk = {
|
|
|
|
nvme = {
|
|
|
|
device = "/dev/nvme0n1";
|
|
|
|
type = "disk";
|
|
|
|
|
|
|
|
content = {
|
|
|
|
type = "gpt";
|
|
|
|
|
|
|
|
partitions = {
|
|
|
|
boot = {
|
|
|
|
type = "EF00";
|
|
|
|
size = "500M";
|
|
|
|
|
|
|
|
content = {
|
|
|
|
type = "filesystem";
|
|
|
|
format = "vfat";
|
|
|
|
mountpoint = "/boot";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
pv_os = {
|
|
|
|
size = "79G";
|
|
|
|
|
|
|
|
content = {
|
|
|
|
type = "lvm_pv";
|
|
|
|
vg = "vg_os";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
pv_nvme_extra = {
|
|
|
|
size = "100%";
|
|
|
|
|
|
|
|
content = {
|
|
|
|
type = "lvm_pv";
|
|
|
|
vg = "vg_data";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
sata = {
|
|
|
|
device = "/dev/sda";
|
|
|
|
type = "disk";
|
|
|
|
|
|
|
|
content = {
|
|
|
|
type = "gpt";
|
|
|
|
|
|
|
|
partitions.pv_sata = {
|
|
|
|
size = "100%";
|
|
|
|
|
|
|
|
content = {
|
|
|
|
type = "lvm_pv";
|
|
|
|
vg = "vg_data";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-02-27 22:28:52 +00:00
|
|
|
};
|
2024-01-06 23:22:44 +00:00
|
|
|
|
2024-05-18 21:32:58 +00:00
|
|
|
lvm_vg = {
|
|
|
|
vg_os = {
|
|
|
|
type = "lvm_vg";
|
|
|
|
|
|
|
|
lvs = {
|
|
|
|
root = {
|
|
|
|
size = "75G";
|
|
|
|
|
|
|
|
content = {
|
|
|
|
type = "filesystem";
|
|
|
|
format = "ext4";
|
|
|
|
mountpoint = "/";
|
|
|
|
mountOptions = [ "defaults" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
swap = {
|
|
|
|
size = "100%FREE";
|
|
|
|
content.type = "swap";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
vg_data = {
|
|
|
|
type = "lvm_vg";
|
|
|
|
|
|
|
|
lvs.longhorn = {
|
|
|
|
size = "100%FREE";
|
|
|
|
|
|
|
|
content = {
|
|
|
|
type = "filesystem";
|
|
|
|
format = "xfs";
|
|
|
|
mountpoint = "/mnt/longhorn";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
2024-05-26 12:34:19 +00:00
|
|
|
};
|
2024-01-06 23:22:44 +00:00
|
|
|
};
|
|
|
|
}
|