diff --git a/flake.lock b/flake.lock index 22f2988e..f3f544f6 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1751949589, - "narHash": "sha256-mgFxAPLWw0Kq+C8P3dRrZrOYEQXOtKuYVlo9xvPntt8=", + "lastModified": 1752077645, + "narHash": "sha256-HM791ZQtXV93xtCY+ZxG1REzhQenSQO020cu6rHtAPk=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "9b008d60392981ad674e04016d25619281550a9d", + "rev": "be9e214982e20b8310878ac2baa063a961c1bdf6", "type": "github" }, "original": { diff --git a/lib/types/zpool.nix b/lib/types/zpool.nix index 2f4530db..40545c4c 100644 --- a/lib/types/zpool.nix +++ b/lib/types/zpool.nix @@ -7,7 +7,7 @@ ... }: let - # TODO: Consider expanding to handle `file` and `draid` mode options. + # TODO: Consider expanding to handle `file` mode option. modeOptions = [ "" "mirror" @@ -16,6 +16,12 @@ let "raidz2" "raidz3" ]; + zpoolModeType = lib.types.mkOptionType { + name = "zpoolMode"; + description = "valid modes for a zpool"; + descriptionClass = "noun"; + check = (x: lib.isString x && (builtins.elem x modeOptions || lib.strings.hasPrefix "draid" x)); + }; in { options = { @@ -72,7 +78,7 @@ in }; type = ( lib.types.oneOf [ - (lib.types.enum modeOptions) + (zpoolModeType) (lib.types.attrsOf ( diskoLib.subType { types = { @@ -83,7 +89,7 @@ in { options = { mode = lib.mkOption { - type = lib.types.enum modeOptions; + type = zpoolModeType; default = ""; description = "Mode of the zfs vdev"; };