mirror of
https://github.com/nix-community/home-manager
synced 2024-12-25 03:09:47 +01:00
eza: replace enableAliases with integration options
This commit is contained in:
parent
3cfa41e342
commit
0236cab5d2
1 changed files with 38 additions and 9 deletions
|
@ -4,16 +4,40 @@ with lib;
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = let
|
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:
|
mkRenamed = opt:
|
||||||
mkRenamedOptionModule [ "programs" "exa" opt ] [ "programs" "eza" 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 ];
|
meta.maintainers = [ maintainers.cafkafk ];
|
||||||
|
|
||||||
options.programs.eza = {
|
options.programs.eza = {
|
||||||
enable = mkEnableOption "eza, a modern replacement for {command}`ls`";
|
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 {
|
extraOptions = mkOption {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
|
@ -49,9 +73,9 @@ with lib;
|
||||||
args = escapeShellArgs (optional cfg.icons "--icons"
|
args = escapeShellArgs (optional cfg.icons "--icons"
|
||||||
++ optional cfg.git "--git" ++ cfg.extraOptions);
|
++ optional cfg.git "--git" ++ cfg.extraOptions);
|
||||||
|
|
||||||
|
optionsAlias = { eza = "eza ${args}"; };
|
||||||
|
|
||||||
aliases = {
|
aliases = {
|
||||||
eza = "eza ${args}";
|
|
||||||
} // optionalAttrs cfg.enableAliases {
|
|
||||||
ls = "eza";
|
ls = "eza";
|
||||||
ll = "eza -l";
|
ll = "eza -l";
|
||||||
la = "eza -a";
|
la = "eza -a";
|
||||||
|
@ -61,14 +85,19 @@ with lib;
|
||||||
in mkIf cfg.enable {
|
in mkIf cfg.enable {
|
||||||
home.packages = [ cfg.package ];
|
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;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue