diff --git a/modules/programs/exa.nix b/modules/programs/exa.nix
index a1b4a2712..897020bbb 100644
--- a/modules/programs/exa.nix
+++ b/modules/programs/exa.nix
@@ -2,19 +2,7 @@
with lib;
-let
-
- cfg = config.programs.exa;
-
- aliases = {
- ls = "${pkgs.exa}/bin/exa";
- ll = "${pkgs.exa}/bin/exa -l";
- la = "${pkgs.exa}/bin/exa -a";
- lt = "${pkgs.exa}/bin/exa --tree";
- lla = "${pkgs.exa}/bin/exa -la";
- };
-
-in {
+{
meta.maintainers = [ hm.maintainers.kalhauge ];
options.programs.exa = {
@@ -23,10 +11,51 @@ in {
enableAliases = mkEnableOption "recommended exa aliases";
+ extraOptions = mkOption {
+ type = types.listOf types.str;
+ default = [ ];
+ example = [ "--group-directories-first" "--header" ];
+ description = ''
+ Extra command line options passed to exa.
+ '';
+ };
+
+ icons = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ Display icons next to file names ( argument).
+ '';
+ };
+
+ git = mkOption {
+ type = types.bool;
+ default = false;
+ description = ''
+ List each file's Git status if tracked or ignored ( argument).
+ '';
+ };
+
package = mkPackageOption pkgs "exa" { };
};
- config = mkIf cfg.enable {
+ config = let
+ cfg = config.programs.exa;
+
+ args = escapeShellArgs (optional cfg.icons "--icons"
+ ++ optional cfg.git "--git" ++ cfg.extraOptions);
+
+ aliases = {
+ # Use `command` instead of hardcoding the path to exa so that aliases don't
+ # go stale after a system update.
+ exa = "exa ${args}";
+ ls = "exa";
+ ll = "exa -l";
+ la = "exa -a";
+ lt = "exa --tree";
+ lla = "exa -la";
+ };
+ in mkIf cfg.enable {
home.packages = [ cfg.package ];
programs.bash.shellAliases = mkIf cfg.enableAliases aliases;