Merge pull request 'vars: add display attribute submodule for customisable ux' (#4559) from vars-display into main

Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/4559
Reviewed-by: DavHau <d.hauer.it@gmail.com>
This commit is contained in:
hsjobeki
2025-08-01 07:55:07 +00:00
2 changed files with 46 additions and 0 deletions

View File

@@ -88,6 +88,14 @@
files.user-password.deploy = false;
prompts.user-password = lib.mkIf settings.prompt {
display = {
group = settings.user;
label = "password";
required = false;
helperText = ''
Your password will be encrypted and stored securely using the secret store you've configured.
'';
};
type = "hidden";
persist = true;
description = "You can autogenerate a password, if you leave this prompt blank.";

View File

@@ -43,6 +43,43 @@ let
{ 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
{
options = {
@@ -303,6 +340,7 @@ in
default = { };
type = attrsOf (
submodule (prompt: {
imports = [ displayModule ];
options = {
name = mkOption {
description = ''