From bffc49ffb255f213d2f902043da37b3016450f4a Mon Sep 17 00:00:00 2001 From: Nikita Pedorich Date: Sat, 3 Jun 2023 22:54:33 +0900 Subject: [PATCH] ripgrep: remove configDir Also minor formatting and news entry. --- modules/misc/news.nix | 8 ++++++++ modules/programs/ripgrep.nix | 25 ++++++++----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/modules/misc/news.nix b/modules/misc/news.nix index a9d0da4f..7138c5b3 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 0adfccc8..10bc1596 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; }; }; }; }