37 lines
879 B
Nix
37 lines
879 B
Nix
{ lib, config, ... }:
|
|
let cfg = config.custom.dataDisk;
|
|
in {
|
|
options = {
|
|
custom = {
|
|
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.
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
};
|
|
|
|
config = lib.mkIf cfg.enable {
|
|
fileSystems.${cfg.mountPoint} = { device = cfg.devicePath; };
|
|
};
|
|
}
|