about summary refs log tree commit diff
path: root/nixos/modules/programs
diff options
context:
space:
mode:
authorSean Buckley <sean.bck@gmail.com>2020-01-28 00:11:43 -0500
committerSean Buckley <sean.bck@gmail.com>2020-01-28 00:11:43 -0500
commit83c36ee797450dcac617de0b0f6fd44e8d839caa (patch)
tree11c7613072771af0289bf7c05db21d2fc698aa79 /nixos/modules/programs
parentf14a4d60b74625547ba7fc0572e42e9b61c0e54f (diff)
downloadnixlib-83c36ee797450dcac617de0b0f6fd44e8d839caa.tar
nixlib-83c36ee797450dcac617de0b0f6fd44e8d839caa.tar.gz
nixlib-83c36ee797450dcac617de0b0f6fd44e8d839caa.tar.bz2
nixlib-83c36ee797450dcac617de0b0f6fd44e8d839caa.tar.lz
nixlib-83c36ee797450dcac617de0b0f6fd44e8d839caa.tar.xz
nixlib-83c36ee797450dcac617de0b0f6fd44e8d839caa.tar.zst
nixlib-83c36ee797450dcac617de0b0f6fd44e8d839caa.zip
nixos/bash: configure $LS_COLORS for interactive shells
Diffstat (limited to 'nixos/modules/programs')
-rw-r--r--nixos/modules/programs/bash/bash.nix13
1 files changed, 13 insertions, 0 deletions
diff --git a/nixos/modules/programs/bash/bash.nix b/nixos/modules/programs/bash/bash.nix
index 366c07c0a352..be964ce7f3f9 100644
--- a/nixos/modules/programs/bash/bash.nix
+++ b/nixos/modules/programs/bash/bash.nix
@@ -32,6 +32,10 @@ let
     fi
   '';
 
+  lsColors = optionalString cfg.enableLsColors ''
+    eval "$(${pkgs.coreutils}/bin/dircolors -b)"
+  '';
+
   bashAliases = concatStringsSep "\n" (
     mapAttrsFlatten (k: v: "alias ${k}=${escapeShellArg v}")
       (filterAttrs (k: v: v != null) cfg.shellAliases)
@@ -127,6 +131,14 @@ in
         type = types.bool;
       };
 
+      enableLsColors = mkOption {
+        default = true;
+        description = ''
+          Enable extra colors in directory listings.
+        '';
+        type = types.bool;
+      };
+
     };
 
   };
@@ -156,6 +168,7 @@ in
 
         ${cfg.promptInit}
         ${bashCompletion}
+        ${lsColors}
         ${bashAliases}
 
         ${cfge.interactiveShellInit}