Files
Olympus/system/disko/disko_bonus.nix
2024-10-19 08:44:02 -05:00

49 lines
1.6 KiB
Nix

{ config, lib, ... }: {
options.sysconfig.opts.devices.bonus = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
default = null;
};
config = lib.mkIf (config.disko.enable && config.sysconfig.opts.devices.bonus != null) {
disko.devices = {
disk = builtins.mapAttrs (name: device: {
inherit device;
type = "disk";
content = {
type = "gpt";
partitions = {
${name} = {
name = "${name}";
size = "100%";
content = {
type = "lvm_pv";
vg = "$name_vg";
};
};
};
};
}) config.sysconfig.opts.devices.bonus;
lvm_vg = builtins.mapAttrs (name: device: {
type = "lvm_vg";
lvs = {
${name} = {
size = "100%FREE";
content = {
type = "btrfs";
extraArgs = [ "-f" ];
subvolumes = {
"/${name}" = {
mountOptions = [ "subvol=${name}" "noatime" ];
mountpoint = "/${name}";
};
};
};
};
};
}) config.sysconfig.opts.devices.bonus;
};
};
}