nixos-servers/nixos/modules/data-disk.nix

38 lines
879 B
Nix
Raw Normal View History

2023-11-24 12:52:51 +00:00
{ lib, config, ... }:
let cfg = config.custom.dataDisk;
in {
options = {
custom = {
2023-12-15 14:20:28 +00:00
dataDisk = {
enable = lib.mkOption {
default = false;
type = lib.types.bool;
description = ''
Whether to automatically mount a disk to be used as a data disk.
'';
};
mountPoint = lib.mkOption {
default = "/mnt/data";
type = lib.types.str;
description = ''
Mount point of the data disk (if enabled).
'';
};
devicePath = lib.mkOption {
default = "/dev/sda1";
type = lib.types.str;
description = ''
Path of the device to be used as a data disk.
'';
};
2023-11-24 12:52:51 +00:00
};
};
};
config = lib.mkIf cfg.enable {
2023-12-15 14:20:28 +00:00
fileSystems.${cfg.mountPoint} = { device = cfg.devicePath; };
2023-11-24 12:52:51 +00:00
};
}