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; }; _partitionTypes = { inherit (diskoLib.types) btrfs filesystem zfs mdraid luks lvm_pv swap; };
partitionType = extraArgs: lib.mkOption { partitionType = extraArgs: lib.mkOption {
type = lib.types.nullOr (diskoLib.subType { type = lib.types.nullOr (diskoLib.subType {
types = diskoLib.partitionTypes; types = diskoLib._partitionTypes;
inherit extraArgs; inherit extraArgs;
}); });
default = null; default = null;
@@ -36,7 +36,7 @@ let
_deviceTypes = { inherit (diskoLib.types) table gpt btrfs filesystem zfs mdraid luks lvm_pv swap; }; _deviceTypes = { inherit (diskoLib.types) table gpt btrfs filesystem zfs mdraid luks lvm_pv swap; };
deviceType = extraArgs: lib.mkOption { deviceType = extraArgs: lib.mkOption {
type = lib.types.nullOr (diskoLib.subType { type = lib.types.nullOr (diskoLib.subType {
types = diskoLib.deviceTypes; types = diskoLib._deviceTypes;
inherit extraArgs; inherit extraArgs;
}); });
default = null; default = null;
@@ -666,9 +666,9 @@ let
}; };
diskoLib = { diskoLib = {
optionTypes.absolute-pathname = "absolute-pathname"; optionTypes.absolute-pathname = "absolute-pathname";
# Spoof these tyeps # Spoof these types to avoid infinite recursion
deviceType = _: "<deviceType>"; deviceType = _: "deviceType";
partitionType = _: "<partitionType>"; partitionType = _: "partitionType";
subType = { types, ... }: { subType = { types, ... }: {
type = "oneOf"; type = "oneOf";
types = lib.attrNames types; types = lib.attrNames types;