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