vars: add display attribute submodule for customizable ux

This commit is contained in:
Johannes Kirschbauer
2025-07-31 16:35:15 +02:00
parent e856d4018a
commit fc2e619046

View File

@@ -43,6 +43,43 @@ let
{ config._module.args.pkgs = pkgs; } { config._module.args.pkgs = pkgs; }
]; ];
}; };
# Display module for prompts
displayModule = {
options = {
display.group = mkOption {
type = nullOr str;
description = ''
The group to display the prompt in.
This is useful to group prompts together.
'';
default = null;
};
display.label = mkOption {
type = nullOr str;
description = ''
The label to display for the prompt.
If not set, the name of the prompt will be used.
'';
default = null;
};
display.required = mkOption {
type = bool;
description = ''
Whether the prompt is required.
If set to false, the user will be able to continue without providing a value.
'';
default = true;
};
display.helperText = mkOption {
type = nullOr str;
description = ''
Additional text to display next to the prompt.
This can be used to provide additional information about the prompt.
'';
default = null;
};
};
};
in in
{ {
options = { options = {
@@ -303,6 +340,7 @@ in
default = { }; default = { };
type = attrsOf ( type = attrsOf (
submodule (prompt: { submodule (prompt: {
imports = [ displayModule ];
options = { options = {
name = mkOption { name = mkOption {
description = '' description = ''