summaryrefslogtreecommitdiff
path: root/nix_archive/nix/programs/bash.nix
blob: cf183760cc65008a9ac871b3bfffe4adb1101fd8 (plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
{ config, pkgs, ... }: {
  users.defaultUserShell = pkgs.bashInteractive;
  environment.sessionVariables = {
    SHELL = "${pkgs.bashInteractive}/bin/bash";
  };
  home-manager.users.andrew = let
    homeDir = "${config.users.users.andrew.home}";
  in {
    programs.bash = {
      enable = true;
      shellAliases = {
        ls = "ls --ignore=lost+found --color=auto";
        cp = "rsync -av";
        top = "htop";
        bc = "bc -l";
        pgrep = "pgrep -f";
        make = "make -j6";
        diff = "diff -u";
        gdb = "gdb -q";
        mail = "neomutt";
        iroha = "ssh andrew@iroha";
        moyo = "ssh andrew@moyo";
        zasshi = "ssh andrew@zasshi";
        denpa = "ssh moyo -t 'ssh 192.168.122.89'";
        rod = "ssh -p 1738 rod";
        bmrg = "ssh boomerang";
        cmv-add = "$HOME/c/camu/scripts/cmv_add.sh";
        cmv-pause = "cmv-add PAUSE";
        cmv-next = "cmv-add NEXT";
        cmv-prev = "cmv-add PREV";
        cmv-shuffle = "cmv-add SHUFFLE";
        cmv-sort = "cmv-add SORT";
        cmv-reverse = "cmv-add REVERSE";
        cmv-clear = "cmv-add CLEAR";
      };
      historyControl = [ "erasedups" ];
      historySize = 10000;
      historyFile = "${homeDir}/.bash_history";
      historyFileSize = 100000;
      initExtra = ''
        bind 'set completion-query-items 0'
        bind 'set show-all-if-ambiguous on'
        bind 'set show-all-if-unmodified on'
        bind 'set menu-complete-display-prefix on'
        bind '"\t": menu-complete'
        bind '"\e[Z": menu-complete-backward'
        RESET="\001\017\002"
        NORMAL="\001\033[0m\002"
        YELLOW="\001\033[0;33m\002"
        BLUE="\001\033[0;34m\002"
        MAGENTA="\001\033[0;35m\002"
        CYAN="\001\033[0;36m\002"
        RED="\001\033[0;31m\002"
        exit_code_guy()
        {
          if [ $? -eq 0 ]; then
            printf "(・_・) >"
          else
            printf "(″ロ゛) >"
          fi
        }
        export PS1="$RESET$MAGENTA\u@$CYAN\H$MAGENTA:\w\$(exit_code_guy)$NORMAL "
      '';
    };
  };
}