2023-07-01 20:02:01 +03:00
|
|
|
{ config, options, lib, diskoLib, parent, device, ... }:
|
2023-01-28 18:19:13 +03:00
|
|
|
{
|
|
|
|
options = {
|
|
|
|
type = lib.mkOption {
|
|
|
|
type = lib.types.enum [ "mdraid" ];
|
|
|
|
internal = true;
|
|
|
|
description = "Type";
|
|
|
|
};
|
2023-07-01 20:02:01 +03:00
|
|
|
device = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
description = "Device";
|
|
|
|
default = device;
|
|
|
|
};
|
2023-01-28 18:19:13 +03:00
|
|
|
|
|
|
|
name = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
description = "Name";
|
|
|
|
};
|
2023-06-07 14:42:39 +03:00
|
|
|
_parent = lib.mkOption {
|
|
|
|
internal = true;
|
|
|
|
default = parent;
|
|
|
|
};
|
2023-01-28 18:19:13 +03:00
|
|
|
_meta = lib.mkOption {
|
|
|
|
internal = true;
|
|
|
|
readOnly = true;
|
|
|
|
type = lib.types.functionTo diskoLib.jsonType;
|
|
|
|
default = dev: {
|
|
|
|
deviceDependencies.mdadm.${config.name} = [ dev ];
|
|
|
|
};
|
|
|
|
description = "Metadata";
|
|
|
|
};
|
|
|
|
_create = diskoLib.mkCreateOption {
|
|
|
|
inherit config options;
|
2023-07-01 20:02:01 +03:00
|
|
|
default = ''
|
2023-07-02 01:17:48 +03:00
|
|
|
echo "${config.device}" >>"$disko_devices_dir"/raid_${config.name}
|
2023-01-28 18:19:13 +03:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
_mount = diskoLib.mkMountOption {
|
|
|
|
inherit config options;
|
2023-07-01 20:02:01 +03:00
|
|
|
default = { };
|
2023-01-28 18:19:13 +03:00
|
|
|
};
|
|
|
|
_config = lib.mkOption {
|
|
|
|
internal = true;
|
|
|
|
readOnly = true;
|
2023-07-01 20:02:01 +03:00
|
|
|
default = [ ];
|
2023-01-28 18:19:13 +03:00
|
|
|
description = "NixOS configuration";
|
|
|
|
};
|
|
|
|
_pkgs = lib.mkOption {
|
|
|
|
internal = true;
|
|
|
|
readOnly = true;
|
|
|
|
type = lib.types.functionTo (lib.types.listOf lib.types.package);
|
|
|
|
default = pkgs: [ pkgs.mdadm ];
|
|
|
|
description = "Packages";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|