vars: add name to generators

This commit is contained in:
Jörg Thalheim
2024-11-20 12:24:38 +01:00
parent 71bcf76feb
commit 0239770978
2 changed files with 20 additions and 1 deletions

View File

@@ -40,6 +40,7 @@ in
generators = lib.flip lib.mapAttrs config.clan.core.vars.generators ( generators = lib.flip lib.mapAttrs config.clan.core.vars.generators (
_name: generator: { _name: generator: {
inherit (generator) inherit (generator)
name
dependencies dependencies
finalScript finalScript
invalidationHash invalidationHash
@@ -49,7 +50,7 @@ in
; ;
files = lib.flip lib.mapAttrs generator.files ( files = lib.flip lib.mapAttrs generator.files (
_name: file: { _name: file: {
inherit (file) deploy secret; inherit (file) name deploy secret;
} }
); );
} }

View File

@@ -46,6 +46,16 @@ in
submodule (generator: { submodule (generator: {
imports = [ ./generator.nix ]; imports = [ ./generator.nix ];
options = { 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 { dependencies = lib.mkOption {
description = '' description = ''
A list of other generators that this generator depends on. A list of other generators that this generator depends on.
@@ -212,6 +222,14 @@ in
type = attrsOf ( type = attrsOf (
submodule (prompt: { submodule (prompt: {
options = { 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 { createFile = lib.mkOption {
description = '' description = ''
Whether the prompted value should be stored in a file with the same name as the prompt. Whether the prompted value should be stored in a file with the same name as the prompt.