Merge pull request #78660 from buckley310/dircolors

nixos/bash: configure $LS_COLORS for interactive shells
This commit is contained in:
Maximilian Bosch 2020-02-05 09:08:41 +01:00 committed by GitHub
commit 87d4951a82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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