2023-06-02 15:59:12 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
2023-06-03 13:54:33 +00:00
|
|
|
let
|
|
|
|
cfg = config.programs.ripgrep;
|
|
|
|
configPath = "${config.xdg.configHome}/ripgrep/ripgreprc";
|
2023-06-02 15:59:12 +00:00
|
|
|
in {
|
|
|
|
meta.maintainers = [ hm.maintainers.pedorich-n ];
|
|
|
|
|
|
|
|
options = {
|
|
|
|
programs.ripgrep = {
|
2023-07-01 23:45:18 +00:00
|
|
|
enable = mkEnableOption "Ripgrep";
|
2023-06-02 15:59:12 +00:00
|
|
|
|
2023-07-01 23:45:18 +00:00
|
|
|
package = mkPackageOption pkgs "ripgrep" { };
|
2023-06-02 15:59:12 +00:00
|
|
|
|
|
|
|
arguments = mkOption {
|
|
|
|
type = with types; listOf str;
|
|
|
|
default = [ ];
|
|
|
|
example = [ "--max-columns-preview" "--colors=line:style:bold" ];
|
2023-07-01 23:45:18 +00:00
|
|
|
description = ''
|
2023-06-03 13:54:33 +00:00
|
|
|
List of arguments to pass to ripgrep. Each item is given to ripgrep as
|
|
|
|
a single command line argument verbatim.
|
2023-06-30 23:30:13 +00:00
|
|
|
|
|
|
|
See <https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#configuration-file>
|
2023-06-02 15:59:12 +00:00
|
|
|
for an example configuration.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2023-07-19 16:18:40 +00:00
|
|
|
home = mkMerge [
|
|
|
|
{ packages = [ cfg.package ]; }
|
|
|
|
(mkIf (cfg.arguments != [ ]) {
|
|
|
|
file."${configPath}".text = lib.concatLines cfg.arguments;
|
|
|
|
|
|
|
|
sessionVariables."RIPGREP_CONFIG_PATH" = configPath;
|
|
|
|
})
|
|
|
|
];
|
2023-06-02 15:59:12 +00:00
|
|
|
};
|
|
|
|
}
|