From cd2ea0d735ff91088e02bef6f52ae682905bb015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Wed, 20 Nov 2024 12:24:38 +0100 Subject: [PATCH] vars: add name to generators --- nixosModules/clanCore/vars/default.nix | 3 ++- nixosModules/clanCore/vars/interface.nix | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/nixosModules/clanCore/vars/default.nix b/nixosModules/clanCore/vars/default.nix index ecdd65879..db8b8744c 100644 --- a/nixosModules/clanCore/vars/default.nix +++ b/nixosModules/clanCore/vars/default.nix @@ -40,6 +40,7 @@ in generators = lib.flip lib.mapAttrs config.clan.core.vars.generators ( _name: generator: { inherit (generator) + name dependencies finalScript invalidationHash @@ -49,7 +50,7 @@ in ; files = lib.flip lib.mapAttrs generator.files ( _name: file: { - inherit (file) deploy secret; + inherit (file) name deploy secret; } ); } diff --git a/nixosModules/clanCore/vars/interface.nix b/nixosModules/clanCore/vars/interface.nix index f28cdc0fc..4d75abf00 100644 --- a/nixosModules/clanCore/vars/interface.nix +++ b/nixosModules/clanCore/vars/interface.nix @@ -46,6 +46,16 @@ in submodule (generator: { imports = [ ./generator.nix ]; options = { + name = lib.mkOption { + type = lib.types.str; + description = '' + The name of the generator. + This name will be used to refer to the generator in other generators. + ''; + readOnly = true; + default = generator.config._module.args.name; + }; + dependencies = lib.mkOption { description = '' A list of other generators that this generator depends on. @@ -212,6 +222,14 @@ in type = attrsOf ( submodule (prompt: { options = { + name = lib.mkOption { + description = '' + The name of the prompt. + This name will be used to refer to the prompt in the generator script. + ''; + type = str; + default = prompt.config._module.args.name; + }; createFile = lib.mkOption { description = '' Whether the prompted value should be stored in a file with the same name as the prompt.