From bbed94d6de3bd6db6135b79e2238518533cf086a Mon Sep 17 00:00:00 2001 From: Johannes Kirschbauer Date: Sat, 10 May 2025 13:58:21 +0200 Subject: [PATCH] Refactor(inventory/manifest): move into seperate file --- .../distributed-service/manifest/default.nix | 42 +++++++++++++++++++ .../distributed-service/service-module.nix | 38 +---------------- 2 files changed, 43 insertions(+), 37 deletions(-) create mode 100644 lib/inventory/distributed-service/manifest/default.nix diff --git a/lib/inventory/distributed-service/manifest/default.nix b/lib/inventory/distributed-service/manifest/default.nix new file mode 100644 index 000000000..0aee5e7ef --- /dev/null +++ b/lib/inventory/distributed-service/manifest/default.nix @@ -0,0 +1,42 @@ +{ lib, ... }: +let + inherit (lib) mkOption; + inherit (lib) types; +in +{ + options = { + name = mkOption { + description = '' + The name of the module + + Mainly used to create an error context while evaluating. + This helps backtracking which module was included; And where an error came from originally. + ''; + type = types.str; + }; + features = mkOption { + description = '' + Enable built-in features for the module + + See the documentation for each feature: + - API + ''; + type = types.submoduleWith { + modules = [ + { + options.API = mkOption { + type = types.bool; + # This is read only, because we don't support turning it off yet + readOnly = true; + default = true; + description = '' + Enables automatic API schema conversion for the interface of this module. + ''; + }; + } + ]; + }; + default = { }; + }; + }; +} diff --git a/lib/inventory/distributed-service/service-module.nix b/lib/inventory/distributed-service/service-module.nix index 89a3eeeb2..e92b53da1 100644 --- a/lib/inventory/distributed-service/service-module.nix +++ b/lib/inventory/distributed-service/service-module.nix @@ -232,43 +232,7 @@ in description = "Meta information about this module itself"; type = submoduleWith { modules = [ - { - options = { - name = mkOption { - description = '' - The name of the module - - Mainly used to create an error context while evaluating. - This helps backtracking which module was included; And where an error came from originally. - ''; - type = types.str; - }; - features = mkOption { - description = '' - Enable built-in features for the module - - See the documentation for each feature: - - API - ''; - type = types.submoduleWith { - modules = [ - { - options.API = mkOption { - type = types.bool; - # This is read only, because we don't support turning it off yet - readOnly = true; - default = true; - description = '' - Enables automatic API schema conversion for the interface of this module. - ''; - }; - } - ]; - }; - default = { }; - }; - }; - } + ./manifest/default.nix ]; }; };