eza: replace enableAliases with integration options

This commit is contained in:
michaelBelsanti 2024-03-08 14:33:29 -05:00 committed by Robert Helgesson
parent 017b12de5b
commit a500de54b2
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED

View file

@ -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;
};
}