ripgrep: remove configDir

Also minor formatting and news entry.
This commit is contained in:
Nikita Pedorich 2023-06-03 22:54:33 +09:00 committed by Robert Helgesson
parent 2951946183
commit bffc49ffb2
No known key found for this signature in database
GPG key ID: 36BDAA14C2797E89
2 changed files with 16 additions and 17 deletions

View file

@ -1033,12 +1033,20 @@ in
defaults to 'null'.
'';
}
{
time = "2023-05-18T21:03:30+00:00";
message = ''
A new module is available: 'programs.script-directory'.
'';
}
{
time = "2023-06-03T22:19:32+00:00";
message = ''
A new module is available: 'programs.ripgrep'.
'';
}
];
};
}

View file

@ -2,7 +2,9 @@
with lib;
let cfg = config.programs.ripgrep;
let
cfg = config.programs.ripgrep;
configPath = "${config.xdg.configHome}/ripgrep/ripgreprc";
in {
meta.maintainers = [ hm.maintainers.pedorich-n ];
@ -12,23 +14,14 @@ in {
package = mkPackageOption pkgs "ripgrep" { };
configDir = mkOption {
type = types.str;
default = "${config.xdg.configHome}/ripgrep";
defaultText =
literalExpression ''"''${config.xdg.configHome}/ripgrep"'';
description = ''
Directory where the <filename>ripgreprc</filename> file will be stored.
'';
};
arguments = mkOption {
type = with types; listOf str;
default = [ ];
example = [ "--max-columns-preview" "--colors=line:style:bold" ];
description = ''
List of arguments to pass to ripgrep. Each item is given to ripgrep as a single command line argument verbatim.
List of arguments to pass to ripgrep. Each item is given to ripgrep as
a single command line argument verbatim.
</para><para>
See <link xlink:href="https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#configuration-file"/>
for an example configuration.
'';
@ -40,12 +33,10 @@ in {
home = {
packages = [ cfg.package ];
file."${cfg.configDir}/ripgreprc" =
file."${configPath}" =
mkIf (cfg.arguments != [ ]) { text = lib.concatLines cfg.arguments; };
sessionVariables = {
"RIPGREP_CONFIG_PATH" = "${cfg.configDir}/ripgreprc";
};
sessionVariables = { "RIPGREP_CONFIG_PATH" = configPath; };
};
};
}