Skip to content

Commit b2a5b29

Browse files
committed
Allow draid in ZFS
1 parent de01849 commit b2a5b29

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/types/zpool.nix

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
...
88
}:
99
let
10-
# TODO: Consider expanding to handle `file` and `draid` mode options.
10+
# TODO: Consider expanding to handle `file` mode option.
1111
modeOptions = [
1212
""
1313
"mirror"
@@ -16,6 +16,12 @@ let
1616
"raidz2"
1717
"raidz3"
1818
];
19+
zpoolModeType = lib.types.mkOptionType {
20+
name = "zpoolMode";
21+
description = "valid modes for a zpool";
22+
descriptionClass = "noun";
23+
check = (x: lib.isString x && (builtins.elem x modeOptions || lib.strings.hasPrefix "draid" x));
24+
};
1925
in
2026
{
2127
options = {
@@ -72,7 +78,7 @@ in
7278
};
7379
type = (
7480
lib.types.oneOf [
75-
(lib.types.enum modeOptions)
81+
(zpoolModeType)
7682
(lib.types.attrsOf (
7783
diskoLib.subType {
7884
types = {
@@ -83,7 +89,7 @@ in
8389
{
8490
options = {
8591
mode = lib.mkOption {
86-
type = lib.types.enum modeOptions;
92+
type = zpoolModeType;
8793
default = "";
8894
description = "Mode of the zfs vdev";
8995
};

0 commit comments

Comments
 (0)