Skip to content

Commit

Permalink
Remove shadowing of config attribute in hooks
Browse files Browse the repository at this point in the history
  • Loading branch information
totoroot committed Mar 19, 2024
1 parent c09e920 commit 20fbe2c
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions modules/hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1340,7 +1340,7 @@ in
default = "auto";
};

config =
configuration =
mkOption {
type = types.str;
description = lib.mdDoc "Multiline-string configuration passed as config file. If set, config set in `typos.settings.configPath` gets ignored.";
Expand Down Expand Up @@ -1461,7 +1461,7 @@ in
type = types.submodule {
imports = hookModule;
options.settings = {
config =
configuration =
mkOption {
type = types.str;
description = lib.mdDoc "Multiline-string configuration passed as config file.";
Expand Down Expand Up @@ -2907,15 +2907,15 @@ in
entry =
let
# Concatenate config in config file with section for ignoring words generated from list of words to ignore
config = "${hooks.typos.settings.config}" + lib.strings.optionalString (hooks.typos.settings.ignored-words != [ ]) "\n\[default.extend-words\]" + lib.strings.concatMapStrings (x: "\n${x} = \"${x}\"") hooks.typos.settings.ignored-words;
configFile = builtins.toFile "typos-config.toml" config;
configuration = "${hooks.typos.settings.configuration}" + lib.strings.optionalString (hooks.typos.settings.ignored-words != [ ]) "\n\[default.extend-words\]" + lib.strings.concatMapStrings (x: "\n${x} = \"${x}\"") hooks.typos.settings.ignored-words;
configFile = builtins.toFile "typos-config.toml" configuration;
cmdArgs =
mkCmdArgs
(with hooks.typos.settings; [
[ binary "--binary" ]
[ (color != "auto") "--color ${color}" ]
[ (config != "") "--config ${configFile}" ]
[ (configPath != "" && config == "") "--config ${configPath}" ]
[ (configuration != "") "--config ${configFile}" ]
[ (configPath != "" && configuration == "") "--config ${configPath}" ]
[ diff "--diff" ]
[ (exclude != "") "--exclude ${exclude} --force-exclude" ]
[ (format != "long") "--format ${format}" ]
Expand Down Expand Up @@ -2945,13 +2945,12 @@ in
package = tools.vale;
entry =
let
# TODO: was .vale.ini, throwed error in Nix
configFile = builtins.toFile "vale.ini" "${hooks.vale.settings.config}";
configFile = builtins.toFile ".vale.ini" "${hooks.vale.settings.configuration}";
cmdArgs =
mkCmdArgs
(with hooks.vale.settings; [
[ (configPath != "") " --config ${configPath}" ]
[ (config != "" && configPath == "") " --config ${configFile}" ]
[ (configuration != "" && configPath == "") " --config ${configFile}" ]
]);
in
"${hooks.vale.package}/bin/vale${cmdArgs} ${hooks.vale.settings.flags}";
Expand Down

0 comments on commit 20fbe2c

Please sign in to comment.