1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 19:46:05 +01:00

grep: init module (#7613)

This commit is contained in:
Benedikt M. Rips 2025-08-05 21:04:24 +02:00 committed by GitHub
parent 36ad7d25fb
commit 0cda19d420
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

37
modules/programs/grep.nix Normal file
View file

@ -0,0 +1,37 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.programs.grep;
in
{
meta.maintainers = [ lib.maintainers.bmrips ];
options.programs.grep = {
enable = lib.mkEnableOption "{command}`grep`.";
package = lib.mkPackageOption pkgs "grep" {
default = "gnugrep";
nullable = true;
};
colors = lib.mkOption {
type = with lib.types; attrsOf str;
default = { };
description = "Settings for {env}`GREP_COLORS`";
example.error = "01;31";
};
};
config = lib.mkIf cfg.enable {
home.packages = lib.mkIf (cfg.package != null) [ cfg.package ];
home.sessionVariables.GREP_COLORS = lib.mkIf (cfg.colors != { }) (
lib.concatStringsSep ":" (lib.mapAttrsToList (n: v: "${n}=${v}") cfg.colors)
);
};
}