From a500de54b2e3067201a40cefa5f210f719423ddf Mon Sep 17 00:00:00 2001 From: michaelBelsanti Date: Fri, 8 Mar 2024 14:33:29 -0500 Subject: [PATCH] eza: replace enableAliases with integration options --- modules/programs/eza.nix | 47 ++++++++++++++++++++++++++++++++-------- 1 file changed, 38 insertions(+), 9 deletions(-) diff --git a/modules/programs/eza.nix b/modules/programs/eza.nix index 0c6c5d7e5..e28c3a54c 100644 --- a/modules/programs/eza.nix +++ b/modules/programs/eza.nix @@ -4,16 +4,40 @@ with lib; { imports = let + msg = '' + 'programs.eza.enableAliases' has been deprecated and replaced with integration + options per shell, for example, 'programs.eza.enableBashIntegration'. + + Note, the default for these options is 'true' so if you want to enable the + aliases you can simply remove 'rograms.eza.enableAliases' from your + configuration.''; mkRenamed = opt: mkRenamedOptionModule [ "programs" "exa" opt ] [ "programs" "eza" opt ]; - in map mkRenamed [ "enable" "enableAliases" "extraOptions" "icons" "git" ]; + in (map mkRenamed [ "enable" "extraOptions" "icons" "git" ]) + ++ [ (mkRemovedOptionModule [ "programs" "eza" "enableAliases" ] msg) ]; meta.maintainers = [ maintainers.cafkafk ]; options.programs.eza = { enable = mkEnableOption "eza, a modern replacement for {command}`ls`"; - enableAliases = mkEnableOption "recommended eza aliases (ls, ll…)"; + enableBashIntegration = mkEnableOption "Bash integration" // { + default = true; + }; + + enableZshIntegration = mkEnableOption "Zsh integration" // { + default = true; + }; + + enableFishIntegration = mkEnableOption "Fish integration" // { + default = true; + }; + + enableIonIntegration = mkEnableOption "Ion integration" // { + default = true; + }; + + enableNushellIntegration = mkEnableOption "Nushell integration"; extraOptions = mkOption { type = types.listOf types.str; @@ -49,9 +73,9 @@ with lib; args = escapeShellArgs (optional cfg.icons "--icons" ++ optional cfg.git "--git" ++ cfg.extraOptions); + optionsAlias = { eza = "eza ${args}"; }; + aliases = { - eza = "eza ${args}"; - } // optionalAttrs cfg.enableAliases { ls = "eza"; ll = "eza -l"; la = "eza -a"; @@ -61,14 +85,19 @@ with lib; in mkIf cfg.enable { home.packages = [ cfg.package ]; - programs.bash.shellAliases = aliases; + programs.bash.shellAliases = optionsAlias + // optionalAttrs cfg.enableBashIntegration aliases; - programs.zsh.shellAliases = aliases; + programs.zsh.shellAliases = optionsAlias + // optionalAttrs cfg.enableZshIntegration aliases; - programs.fish.shellAliases = aliases; + programs.fish.shellAliases = optionsAlias + // optionalAttrs cfg.enableFishIntegration aliases; - programs.ion.shellAliases = aliases; + programs.ion.shellAliases = optionsAlias + // optionalAttrs cfg.enableIonIntegration aliases; - programs.nushell.shellAliases = aliases; + programs.nushell.shellAliases = optionsAlias + // optionalAttrs cfg.enableNushellIntegration aliases; }; }