diff --git a/modules/misc/news.nix b/modules/misc/news.nix
index a9d0da4ff..7138c5b30 100644
--- a/modules/misc/news.nix
+++ b/modules/misc/news.nix
@@ -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'.
+ '';
+ }
];
};
}
diff --git a/modules/programs/ripgrep.nix b/modules/programs/ripgrep.nix
index 0adfccc8e..10bc1596b 100644
--- a/modules/programs/ripgrep.nix
+++ b/modules/programs/ripgrep.nix
@@ -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 ripgreprc 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.
+
See
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; };
};
};
}