pkgs.formats.elixirConf: Allow for Elixir charlists
These are needed for defining strings that reach through to Erlang code
This commit is contained in:
@@ -607,6 +607,8 @@ optionalAttrs allowAliases aliases
|
||||
elixirMap value
|
||||
else if _elixirType == "tuple" then
|
||||
tuple value
|
||||
else if _elixirType == "charlist" then
|
||||
charlist value
|
||||
else
|
||||
abort "formats.elixirConf: should never happen (_elixirType = ${_elixirType})";
|
||||
|
||||
@@ -620,6 +622,8 @@ optionalAttrs allowAliases aliases
|
||||
|
||||
tuple = values: "{${listContent values}}";
|
||||
|
||||
charlist = value: "~c\"${value}\"";
|
||||
|
||||
toConf =
|
||||
let
|
||||
keyConfig =
|
||||
@@ -687,6 +691,12 @@ optionalAttrs allowAliases aliases
|
||||
_elixirType = "atom";
|
||||
};
|
||||
|
||||
# Make an Elixir charlist out of a string.
|
||||
mkCharlist = value: {
|
||||
inherit value;
|
||||
_elixirType = "charlist";
|
||||
};
|
||||
|
||||
# Make an Elixir tuple out of a list.
|
||||
mkTuple = value: {
|
||||
inherit value;
|
||||
@@ -727,6 +737,12 @@ optionalAttrs allowAliases aliases
|
||||
check = isElixirType "atom";
|
||||
});
|
||||
|
||||
charlist = elixirOr (mkOptionType {
|
||||
name = "elixirCharlist";
|
||||
description = "elixir charlist";
|
||||
check = isElixirType "charlist";
|
||||
});
|
||||
|
||||
tuple = elixirOr (mkOptionType {
|
||||
name = "elixirTuple";
|
||||
description = "elixir tuple";
|
||||
|
||||
Reference in New Issue
Block a user