Refactor(inventory): move prio 'introspection' into inventoryClass to minimize the 'clanInternals' api
This commit is contained in:
@@ -152,7 +152,6 @@ in
|
|||||||
# Those options are interfaced by the CLI
|
# Those options are interfaced by the CLI
|
||||||
# We don't specify the type here, for better performance.
|
# We don't specify the type here, for better performance.
|
||||||
inventory = lib.mkOption { type = lib.types.raw; };
|
inventory = lib.mkOption { type = lib.types.raw; };
|
||||||
inventoryValuesPrios = lib.mkOption { type = lib.types.raw; };
|
|
||||||
# all exported clan templates from this clan
|
# all exported clan templates from this clan
|
||||||
templates = lib.mkOption { type = lib.types.raw; };
|
templates = lib.mkOption { type = lib.types.raw; };
|
||||||
# all exported clan modules from this clan
|
# all exported clan modules from this clan
|
||||||
|
|||||||
@@ -201,14 +201,12 @@ in
|
|||||||
modules = config.modules;
|
modules = config.modules;
|
||||||
|
|
||||||
inherit inventoryFile;
|
inherit inventoryFile;
|
||||||
inventoryValuesPrios =
|
|
||||||
# Temporary workaround
|
|
||||||
builtins.removeAttrs (clan-core.clanLib.introspection.getPrios { options = inventory.options; })
|
|
||||||
# tags are freeformType which is not supported yet.
|
|
||||||
[ "tags" ];
|
|
||||||
|
|
||||||
templates = config.templates;
|
templates = config.templates;
|
||||||
inventory = config.inventory;
|
inventory = config.inventory;
|
||||||
|
# TODO: Remove this in about a month
|
||||||
|
# It is only here for backwards compatibility for people with older CLI versions
|
||||||
|
inventoryValuesPrios = inventoryClass.introspection;
|
||||||
meta = config.inventory.meta;
|
meta = config.inventory.meta;
|
||||||
|
|
||||||
source = "${clan-core}";
|
source = "${clan-core}";
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ let
|
|||||||
}) config.distributedServices.allMachines;
|
}) config.distributedServices.allMachines;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
(lib.modules.importApply ./inventory-introspection.nix { inherit clanLib; })
|
||||||
];
|
];
|
||||||
}).config;
|
}).config;
|
||||||
in
|
in
|
||||||
|
|||||||
17
lib/inventory/build-inventory/inventory-introspection.nix
Normal file
17
lib/inventory/build-inventory/inventory-introspection.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{ clanLib }:
|
||||||
|
{
|
||||||
|
config,
|
||||||
|
options,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
options.introspection = lib.mkOption {
|
||||||
|
readOnly = true;
|
||||||
|
# TODO: use options.inventory instead of the evaluate config attribute
|
||||||
|
default =
|
||||||
|
builtins.removeAttrs (clanLib.introspection.getPrios { options = config.inventory.options; })
|
||||||
|
# tags are freeformType which is not supported yet.
|
||||||
|
[ "tags" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -375,7 +375,7 @@ def get_inventory_current_priority(flake_dir: str | Path) -> dict:
|
|||||||
"""
|
"""
|
||||||
cmd = nix_eval(
|
cmd = nix_eval(
|
||||||
[
|
[
|
||||||
f"{flake_dir}#clanInternals.inventoryValuesPrios",
|
f"{flake_dir}#clanInternals.inventoryClass.introspection",
|
||||||
"--json",
|
"--json",
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user