fix(inventory/instances): fix jsonschema compatibility
This commit is contained in:
@@ -15,24 +15,6 @@ in
|
||||
...
|
||||
}:
|
||||
{
|
||||
devShells.inventory-schema = pkgs.mkShell {
|
||||
inputsFrom = with config.checks; [
|
||||
lib-inventory-eval
|
||||
self'.devShells.default
|
||||
];
|
||||
};
|
||||
|
||||
legacyPackages.schemas = (
|
||||
import ./schemas {
|
||||
inherit
|
||||
pkgs
|
||||
self
|
||||
lib
|
||||
self'
|
||||
;
|
||||
}
|
||||
);
|
||||
|
||||
# Run: nix-unit --extra-experimental-features flakes --flake .#legacyPackages.x86_64-linux.<attrName>
|
||||
legacyPackages.evalTest-distributedServices = import ./tests {
|
||||
inherit lib self;
|
||||
@@ -45,7 +27,7 @@ in
|
||||
nix-unit --eval-store "$HOME" \
|
||||
--extra-experimental-features flakes \
|
||||
${inputOverrides} \
|
||||
--flake ${self}#legacyPackages.${system}.distributedServices
|
||||
--flake ${self}#legacyPackages.${system}.evalTest-distributedServices
|
||||
|
||||
touch $out
|
||||
'';
|
||||
|
||||
@@ -204,8 +204,9 @@ in
|
||||
elemType = submoduleWith {
|
||||
modules = [
|
||||
(m: {
|
||||
# TODO: make this a deferred module?
|
||||
# TODO: Move the deferred module type into inventory interface ?
|
||||
options.settings = mkOption {
|
||||
type = types.deferredModule;
|
||||
description = "Settings of '${name}-machine': ${m.name}.";
|
||||
default = { };
|
||||
};
|
||||
@@ -220,6 +221,7 @@ in
|
||||
# options._settingsViaTags = mkOption { };
|
||||
# A deferred module that combines _settingsViaTags with _settings
|
||||
options.settings = mkOption {
|
||||
type = types.deferredModule;
|
||||
description = "Settings of 'role': ${name}";
|
||||
default = { };
|
||||
};
|
||||
|
||||
@@ -103,7 +103,9 @@ in
|
||||
default = options;
|
||||
};
|
||||
modules = lib.mkOption {
|
||||
type = types.attrsOf (types.either types.path types.deferredModule);
|
||||
# Don't define the type yet
|
||||
# We manually transform the value with types.deferredModule.merge later to keep them serializable
|
||||
type = types.attrsOf types.raw;
|
||||
default = { };
|
||||
defaultText = "clanModules of clan-core";
|
||||
description = ''
|
||||
@@ -310,7 +312,9 @@ in
|
||||
types.submodule {
|
||||
options.settings = lib.mkOption {
|
||||
default = { };
|
||||
type = types.deferredModule;
|
||||
# Dont transform the value with `types.deferredModule` here. We need to keep it json serializable
|
||||
# TODO: We need a custom serializer for deferredModule
|
||||
type = types.attrsOf types.raw;
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -321,7 +325,7 @@ in
|
||||
types.submodule {
|
||||
options.settings = lib.mkOption {
|
||||
default = { };
|
||||
type = types.deferredModule;
|
||||
type = types.attrsOf types.raw;
|
||||
};
|
||||
}
|
||||
);
|
||||
@@ -329,7 +333,7 @@ in
|
||||
};
|
||||
settings = lib.mkOption {
|
||||
default = { };
|
||||
type = types.deferredModule;
|
||||
type = types.attrsOf types.raw;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -32,6 +32,8 @@ def map_json_type(
|
||||
return {"str"}
|
||||
if json_type == "integer":
|
||||
return {"int"}
|
||||
if json_type == "number":
|
||||
return {"float"}
|
||||
if json_type == "boolean":
|
||||
return {"bool"}
|
||||
# In Python, "number" is analogous to the float type.
|
||||
|
||||
Reference in New Issue
Block a user