vars: rename createFile -> persist
This commit is contained in:
@@ -52,7 +52,7 @@ let
|
|||||||
migrateFact = "${secret_id opt}";
|
migrateFact = "${secret_id opt}";
|
||||||
prompts.${secret_id opt} = {
|
prompts.${secret_id opt} = {
|
||||||
type = "hidden";
|
type = "hidden";
|
||||||
createFile = true;
|
persist = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -14,9 +14,9 @@ let
|
|||||||
name = "iwd.${name}";
|
name = "iwd.${name}";
|
||||||
value = {
|
value = {
|
||||||
prompts.ssid.type = "line";
|
prompts.ssid.type = "line";
|
||||||
prompts.ssid.createFile = true;
|
prompts.ssid.persist = true;
|
||||||
prompts.password.type = "hidden";
|
prompts.password.type = "hidden";
|
||||||
prompts.password.createFile = true;
|
prompts.password.persist = true;
|
||||||
share = true;
|
share = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ let
|
|||||||
|
|
||||||
promptsToFilesScript = concatMapStrings promptToFile;
|
promptsToFilesScript = concatMapStrings promptToFile;
|
||||||
|
|
||||||
filePromptNames = attrNames (filterAttrs (_name: prompt: prompt.createFile) config.prompts);
|
filePromptNames = attrNames (filterAttrs (_name: prompt: prompt.persist) config.prompts);
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
finalScript = mkOptionDefault (
|
finalScript = mkOptionDefault (
|
||||||
|
|||||||
@@ -253,6 +253,9 @@ in
|
|||||||
default = { };
|
default = { };
|
||||||
type = attrsOf (
|
type = attrsOf (
|
||||||
submodule (prompt: {
|
submodule (prompt: {
|
||||||
|
imports = [
|
||||||
|
(lib.mkRenamedOptionModule [ "createFile" ] [ "persist" ])
|
||||||
|
];
|
||||||
options = {
|
options = {
|
||||||
name = lib.mkOption {
|
name = lib.mkOption {
|
||||||
description = ''
|
description = ''
|
||||||
@@ -263,7 +266,7 @@ in
|
|||||||
default = prompt.config._module.args.name;
|
default = prompt.config._module.args.name;
|
||||||
defaultText = "Name of the prompt";
|
defaultText = "Name of the prompt";
|
||||||
};
|
};
|
||||||
createFile = lib.mkOption {
|
persist = 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.
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class Prompt:
|
|||||||
name=data["name"],
|
name=data["name"],
|
||||||
description=data["description"],
|
description=data["description"],
|
||||||
prompt_type=PromptType(data["type"]),
|
prompt_type=PromptType(data["type"]),
|
||||||
create_file=data["createFile"],
|
create_file=data.get("persist", data["createFile"]),
|
||||||
previous_value=data.get("previousValue"),
|
previous_value=data.get("previousValue"),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -477,14 +477,14 @@ def test_prompt(
|
|||||||
my_generator["files"]["multiline_value"]["secret"] = False
|
my_generator["files"]["multiline_value"]["secret"] = False
|
||||||
|
|
||||||
my_generator["prompts"]["prompt1"]["description"] = "dream2nix"
|
my_generator["prompts"]["prompt1"]["description"] = "dream2nix"
|
||||||
my_generator["prompts"]["prompt1"]["createFile"] = False
|
my_generator["prompts"]["prompt1"]["persist"] = False
|
||||||
my_generator["prompts"]["prompt1"]["type"] = "line"
|
my_generator["prompts"]["prompt1"]["type"] = "line"
|
||||||
|
|
||||||
my_generator["prompts"]["prompt2"]["description"] = "dream2nix"
|
my_generator["prompts"]["prompt2"]["description"] = "dream2nix"
|
||||||
my_generator["prompts"]["prompt2"]["createFile"] = False
|
my_generator["prompts"]["prompt2"]["persist"] = False
|
||||||
my_generator["prompts"]["prompt2"]["type"] = "line"
|
my_generator["prompts"]["prompt2"]["type"] = "line"
|
||||||
|
|
||||||
my_generator["prompts"]["prompt_create_file"]["createFile"] = True
|
my_generator["prompts"]["prompt_create_file"]["persist"] = True
|
||||||
|
|
||||||
my_generator["script"] = (
|
my_generator["script"] = (
|
||||||
"cat $prompts/prompt1 > $out/line_value; cat $prompts/prompt2 > $out/multiline_value"
|
"cat $prompts/prompt1 > $out/line_value; cat $prompts/prompt2 > $out/multiline_value"
|
||||||
|
|||||||
Reference in New Issue
Block a user