summaryrefslogtreecommitdiffstats
path: root/types.nix
diff options
context:
space:
mode:
authorJörg Thalheim <joerg@thalheim.io>2022-09-04 11:46:37 +0200
committerJörg Thalheim <joerg@thalheim.io>2022-09-04 12:12:09 +0200
commite0de34c07d1b78b81f6c3fbf3aa41f08ef8db7fb (patch)
tree088ac9e1a8f6148654562ee2d6977cbf587d5688 /types.nix
parentdcb0c42857a2ada8754d4514d4b8c4c1d67ab3f5 (diff)
make error message nicer if type is ommitted
Diffstat (limited to 'types.nix')
-rw-r--r--types.nix6
1 files changed, 5 insertions, 1 deletions
diff --git a/types.nix b/types.nix
index e7dcf60..8e4e2a6 100644
--- a/types.nix
+++ b/types.nix
@@ -10,7 +10,7 @@ rec {
subType = typeAttr: mkOptionType rec {
name = "subType";
description = "one of ${attrNames typeAttr}";
- check = x: typeAttr.${x.type}.check x;
+ check = x: if x ? type then typeAttr.${x.type}.check x else throw "No type option set in:\n${generators.toPretty {} x}";
merge = loc: defs:
foldl' (res: def: typeAttr.${def.value.type}.merge loc [def]) {} defs;
nestedTypes = typeAttr;
@@ -780,6 +780,7 @@ rec {
type = mkOption {
type = types.enum [ "zfs_dataset" ];
default = "zfs_dataset";
+ internal = true;
};
zfs_type = mkOption {
type = types.enum [ "filesystem" "volume" ];
@@ -867,6 +868,7 @@ rec {
type = mkOption {
type = types.enum [ "mdadm" ];
default = "mdadm";
+ internal = true;
};
level = mkOption {
type = types.int;
@@ -914,6 +916,7 @@ rec {
options = {
type = mkOption {
type = types.enum [ "mdraid" ];
+ internal = true;
};
name = mkOption {
@@ -955,6 +958,7 @@ rec {
options = {
type = mkOption {
type = types.enum [ "luks" ];
+ internal = true;
};
name = mkOption {
type = types.str;