treewide: implement auto importing for modules
Reduce maintenance burden and increase efficiency by automatically importing modules following a specific convention. Co-authored-by: awwpotato <awwpotato@voidq.com> Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
This commit is contained in:
parent
fefeb0e928
commit
4fca600cb1
461 changed files with 72 additions and 474 deletions
54
modules/programs/ripgrep/default.nix
Normal file
54
modules/programs/ripgrep/default.nix
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.programs.ripgrep;
|
||||
in
|
||||
{
|
||||
meta.maintainers = [
|
||||
lib.maintainers.khaneliman
|
||||
lib.hm.maintainers.pedorich-n
|
||||
];
|
||||
|
||||
options = {
|
||||
programs.ripgrep = {
|
||||
enable = lib.mkEnableOption "Ripgrep";
|
||||
|
||||
package = lib.mkPackageOption pkgs "ripgrep" { nullable = true; };
|
||||
|
||||
arguments = lib.mkOption {
|
||||
type = with lib.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.
|
||||
|
||||
See <https://github.com/BurntSushi/ripgrep/blob/master/GUIDE.md#configuration-file>
|
||||
for an example configuration.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
home =
|
||||
let
|
||||
configPath = "${config.xdg.configHome}/ripgrep/ripgreprc";
|
||||
in
|
||||
lib.mkMerge [
|
||||
{ packages = lib.mkIf (cfg.package != null) [ cfg.package ]; }
|
||||
(lib.mkIf (cfg.arguments != [ ]) {
|
||||
file."${configPath}".text = lib.concatLines cfg.arguments;
|
||||
|
||||
sessionVariables."RIPGREP_CONFIG_PATH" = configPath;
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue