diff --git a/docs/release-notes/rl-2411.md b/docs/release-notes/rl-2411.md index 6f7a6b7b0..626624640 100644 --- a/docs/release-notes/rl-2411.md +++ b/docs/release-notes/rl-2411.md @@ -18,6 +18,11 @@ This release has the following notable changes: add `-w` to your assignment of [services.swayidle.extraArgs](#opt-services.swayidle.extraArgs). +- Support for Boolean values in the option + [programs.eza.icons](#opt-programs.eza.icons) is deprecated for + future removal. The new value for `true` is `"auto"`, and for + `false` it is `null`. + ## State Version Changes {#sec-release-24.11-state-version-changes} The state version in this release includes the changes below. These diff --git a/modules/programs/eza.nix b/modules/programs/eza.nix index d55d6f56e..679f53499 100644 --- a/modules/programs/eza.nix +++ b/modules/programs/eza.nix @@ -49,10 +49,13 @@ with lib; }; icons = mkOption { - type = types.bool; - default = false; + type = types.enum [ null true false "auto" "always" "never" ]; + default = null; description = '' Display icons next to file names ({option}`--icons` argument). + + Note, the support for Boolean values is deprecated. + Setting this option to `true` corresponds to `--icons=auto`. ''; }; @@ -70,8 +73,15 @@ with lib; config = let cfg = config.programs.eza; - args = escapeShellArgs (optional cfg.icons "--icons" - ++ optional cfg.git "--git" ++ cfg.extraOptions); + iconsOption = let + v = if isBool cfg.icons then + (if cfg.icons then "auto" else null) + else + cfg.icons; + in optionals (v != null) [ "--icons" v ]; + + args = escapeShellArgs + (iconsOption ++ optional cfg.git "--git" ++ cfg.extraOptions); optionsAlias = optionalAttrs (args != "") { eza = "eza ${args}"; }; @@ -83,6 +93,12 @@ with lib; lla = "eza -la"; }; in mkIf cfg.enable { + warnings = optional (isBool cfg.icons) '' + Setting programs.eza.icons to a Boolean is deprecated. + Please update your configuration so that + + programs.eza.icons = ${if cfg.icons then ''"auto"'' else "null"}''; + home.packages = [ cfg.package ]; programs.bash.shellAliases = optionsAlias