From 66ee74e193638933095349b742f0eb46777ee432 Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Thu, 26 Jun 2025 13:00:23 +0200 Subject: [PATCH] schema: update clan option source --- lib/modules/default.nix | 1 + lib/modules/inventory/schemas/default.nix | 15 ++++++++++++++- pkgs/clan-cli/clan_lib/nix_models/clan.py | 4 ---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/modules/default.nix b/lib/modules/default.nix index f3af36ece..a1f52072f 100644 --- a/lib/modules/default.nix +++ b/lib/modules/default.nix @@ -34,6 +34,7 @@ Public attributes of buildClan. As specified in publicAttrs. */ buildClanWith = + { clan-core, # TODO: Below should be module options such that the user can override them? diff --git a/lib/modules/inventory/schemas/default.nix b/lib/modules/inventory/schemas/default.nix index bbb3af493..a7e92f589 100644 --- a/lib/modules/inventory/schemas/default.nix +++ b/lib/modules/inventory/schemas/default.nix @@ -1,6 +1,7 @@ { self, self', + lib, pkgs, flakeOptions, ... @@ -23,7 +24,19 @@ let _module.args = { inherit (self) clanLib; }; }); - clanSchema = jsonLib.parseOptions (flakeOptions.clan.type.getSubOptions [ "clan" ]) { }; + opts = (flakeOptions.flake.type.getSubOptions [ "flake" ]); + clanOpts = opts.clan.type.getSubOptions [ "clan" ]; + include = [ + "directory" + "inventory" + "machines" + "meta" + "modules" + "outputs" + "secrets" + "templates" + ]; + clanSchema = jsonLib.parseOptions (lib.filterAttrs (n: _v: lib.elem n include) clanOpts) { }; renderSchema = pkgs.writers.writePython3Bin "render-schema" { flakeIgnore = [ diff --git a/pkgs/clan-cli/clan_lib/nix_models/clan.py b/pkgs/clan-cli/clan_lib/nix_models/clan.py index ab0cde71f..b8f0f282f 100644 --- a/pkgs/clan-cli/clan_lib/nix_models/clan.py +++ b/pkgs/clan-cli/clan_lib/nix_models/clan.py @@ -187,8 +187,6 @@ ClanMetaType = Unknown ClanModulesType = dict[str, dict[str, Any] | list[Any] | bool | float | int | str | None] ClanOutputsType = Output ClanSecretsType = Secret -ClanSelfType = dict[str, Any] | list[Any] | bool | float | int | str -ClanSpecialargsType = dict[str, dict[str, Any] | list[Any] | bool | float | int | str | None] ClanTemplatesType = Template class Clan(TypedDict): @@ -199,6 +197,4 @@ class Clan(TypedDict): modules: NotRequired[ClanModulesType] outputs: NotRequired[ClanOutputsType] secrets: NotRequired[ClanSecretsType] - self: NotRequired[ClanSelfType] - specialArgs: NotRequired[ClanSpecialargsType] templates: NotRequired[ClanTemplatesType]