nixos-config/config/bash.nix

45 lines
929 B
Nix
Raw Normal View History

2021-01-15 10:26:39 -08:00
{ config, lib, pkgs, ... }:
let
helpers = pkgs.writeText "bash.helpers"
(builtins.readFile ../static/bash/bash.helpers);
2021-01-15 10:26:39 -08:00
colors =
pkgs.writeText "bash.colors" (builtins.readFile ../static/bash/bash.colors);
2021-01-15 10:26:39 -08:00
env = pkgs.writeText "bash.env" (builtins.readFile ../static/bash/bash.env);
2021-01-15 10:26:39 -08:00
in {
config.programs.bash = {
shellAliases = {
ll = "ls $LS_OPTIONS -alF";
l = "ls $LS_OPTIONS -CF";
la = "ls $LS_OPTIONS -A";
".." = "cd ..";
"..." = "cd ../..";
rm = "rm --one-file-system --preserve-root";
};
shellInit = ''
if [ -d $HOME/bin ]; then
PATH="$HOME/bin:$PATH"
fi
'';
interactiveShellInit = ''
case $TERM in
screen|xterm*|rxvt*)
export LS_OPTIONS="--color=auto"
;;
*)
export LS_OPTIONS=""
;;
esac
. ${colors}
. ${helpers}
. ${env}
'';
};
}