lib: Fix jsonTypes evaluation

This will be very useful for generating documentation and python type
definitions.
This commit is contained in:
Felix Uhl committed 2024-11-17 15:08:26 +01:00
1 parent d382a3cccf
commit 08ec11ae1b
1 file changed
+5 -5
+5 -5
View File
@@ -25,7 +25,7 @@ let
_partitionTypes = { inherit (diskoLib.types) btrfs filesystem zfs mdraid luks lvm_pv swap; };
partitionType = extraArgs: lib.mkOption {
type = lib.types.nullOr (diskoLib.subType {
types = diskoLib.partitionTypes;
types = diskoLib._partitionTypes;
inherit extraArgs;
});
default = null;
@@ -36,7 +36,7 @@ let
_deviceTypes = { inherit (diskoLib.types) table gpt btrfs filesystem zfs mdraid luks lvm_pv swap; };
deviceType = extraArgs: lib.mkOption {
type = lib.types.nullOr (diskoLib.subType {
types = diskoLib.deviceTypes;
types = diskoLib._deviceTypes;
inherit extraArgs;
});
default = null;
@@ -666,9 +666,9 @@ let
};
diskoLib = {
optionTypes.absolute-pathname = "absolute-pathname";
# Spoof these tyeps
deviceType = _: "<deviceType>";
partitionType = _: "<partitionType>";
# Spoof these types to avoid infinite recursion
deviceType = _: "deviceType";
partitionType = _: "partitionType";
subType = { types, ... }: {
type = "oneOf";
types = lib.attrNames types;