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

34 lines
755 B
Nix
Raw Normal View History

2023-11-24 12:52:51 +00:00
{ lib, config, ... }:
2023-12-29 12:46:12 +00:00
let cfg = config.lab.dataDisk;
2023-11-24 12:52:51 +00:00
in {
2023-12-29 12:46:12 +00:00
options.lab.dataDisk = {
enable = lib.mkOption {
default = false;
type = lib.types.bool;
description = ''
Whether to automatically mount a disk to be used as a data disk.
'';
};
2023-12-15 14:20:28 +00:00
2023-12-29 12:46:12 +00:00
mountPoint = lib.mkOption {
default = "/mnt/data";
type = lib.types.str;
description = ''
Mount point of the data disk (if enabled).
'';
};
2023-12-15 14:20:28 +00:00
2023-12-29 12:46:12 +00:00
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
};
}