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