aboutsummaryrefslogtreecommitdiff
path: root/bash.nix
blob: 5e757bd5d2862f365a9af64aae32b22c77a68b0b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
{ config, lib, pkgs, ... }:

{
  programs.bash = {
    enable = true;

    sessionVariables = {
      # for when Nix supports this
      NIX_SHELL_PRESERVE_PROMPT = "1";
    };

    initExtra = ''
      TITLEBAR='\[\033]0;\u@\h:\w\007\]'

      if [ -z $IN_NIX_SHELL ] ; then
        export PS1="$TITLEBAR[\[\e[34m\]\u@\h \W\[\e[39m\]]\$ "
      else
        export PS1="$TITLEBAR[\[\e[34m\]\u@\h \W\[\e[39m\]]* "
      fi
      export PS2="> "
    '';
  };

  # automatically add the slash after a sym-linked directory
  # https://unix.stackexchange.com/questions/257861
  home.file.".inputrc".text = ''
    set mark-symlinked-directories on
  '';
}