From 20fbe2c9731810b1020572a2cb6cbf64e3dd3873 Mon Sep 17 00:00:00 2001 From: Matthias Thym Date: Fri, 16 Feb 2024 11:35:36 +0100 Subject: [PATCH] Remove shadowing of `config` attribute in hooks --- modules/hooks.nix | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/modules/hooks.nix b/modules/hooks.nix index 53ddf309..ae2100ae 100644 --- a/modules/hooks.nix +++ b/modules/hooks.nix @@ -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."; @@ -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."; @@ -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}" ] @@ -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}";