stylix/modules/fzf/hm.nix
Jalil David Salamé Messina 7682713f6a
stylix: add 'stylix.enable' option (#244)
Add a 'stylix.enable' option to enable or disable all Stylix modules in
order to resolve issues similar to [2].

To align with the default 'lib.mkEnableOption' [1] behavior,
'stylix.enable' defaults to 'false'.

BREAKING CHANGE: Stylix is disabled by default. To enable it, use:

    stylix.enable = true;

[1]: https://github.com/NixOS/nixpkgs/blob/23.11/lib/options.nix#L91-L105
[2]: https://github.com/danth/stylix/issues/216

Co-authored-by: Daniel Thwaites <danthwaites30@btinternet.com>
Co-authored-by: Jalil David Salamé Messina <jalil.salame@gmail.com>
Co-authored-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
2024-06-10 11:52:47 +02:00

29 lines
770 B
Nix

{ pkgs, config, lib, ... }:
let
mkFzfKeyValue = lib.generators.mkKeyValueDefault { } ":";
colorConfig = with config.lib.stylix.colors.withHashtag;
lib.concatStringsSep "," (lib.mapAttrsToList mkFzfKeyValue {
"bg" = base00;
"bg+" = base01;
"fg" = base04;
"fg+" = base06;
"header" = base0D;
"hl" = base0D;
"hl+" = base0D;
"info" = base0A;
"marker" = base0C;
"pointer" = base0C;
"prompt" = base0A;
"spinner" = base0C;
});
in
{
options.stylix.targets.fzf = {
enable = config.lib.stylix.mkEnableTarget "Fzf" true;
};
config = lib.mkIf (config.stylix.enable && config.stylix.targets.fzf.enable) {
programs.fzf.defaultOptions = lib.mkAfter [ "--color=${colorConfig}" ];
};
}