summaryrefslogtreecommitdiff
path: root/home.nix
blob: a2e9e72f9b05ce7adfe7fc2480705be90fa11fe5 (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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
{ pkgs, ... }:

{
  home.packages = [
    pkgs.ag
    pkgs.cabal2nix
    pkgs.cloc
    pkgs.dict
    pkgs.entr
    pkgs.fasd
    pkgs.file
    pkgs.gimp
    pkgs.jq
    pkgs.keepassx
    pkgs.keybase
    pkgs.keybase-gui
    pkgs.mplayer
    pkgs.mpv
    pkgs.offlineimap
    pkgs.pavucontrol
    pkgs.pinentry
    pkgs.qtpass
    pkgs.racket
    pkgs.ranger
    pkgs.ripgrep
    pkgs.scrot
    pkgs.shutter
    pkgs.stack2nix
    pkgs.tdesktop
    pkgs.transmission-gtk
    pkgs.tree
    pkgs.unrar
    pkgs.vlc
    pkgs.vpnc
    pkgs.w3m
    pkgs.wakatime
    pkgs.yank
    pkgs.youtube-dl
  ];

  programs.git = {
    enable = true;
    userName  = "Ben Sima";
    userEmail = "ben@bsima.me";
    extraConfig = ''
[push]
  default = simple
[branch "master]
  remote = upstream
  merge = refs/heads/master
[remote]
  pushDefault = origin
[commit]
  template = ~/.config/nixpkgs/git-commit-template
    '';
  };

  programs.bash = {
    enable = true;
    shellAliases = {
      a = "fasd -a";        # any
      s = "fasd -si";       # show / search / select
      d = "fasd -d";        # directory
      f = "fasd -f";        # file
      sd = "fasd -sid";     # interactive directory selection
      sf = "fasd -sif";     # interactive file selection
      z = "fasd_cd -d";     # cd, same functionality as j in autojump
      zz = "fasd_cd -d -i"; # cd with interactive selection
      g = "grep -in";
      rm = "rm -i";
      myip = "ifconfig | grep 'inet ' | grep -v 127.0.0.1 | cut -d\   -f10";
      ddate = "date +%Y.%m.%d";
      tdate = "date +%Y.%m.%d..%H.%M";
      ttime = "date +%H.%M";
      day = "date +%a";
      dday = "date +%A";
      gl = "git pull --prune";
      glog = ''git log --graph --pretty=format:"%Cred%h%Creset %an: %s - %Creset %C(yellow)%d%Creset %Cgreen(%cr)%Creset" --abbrev-commit --date=relative'';
      gp = "git push origin HEAD";
      gd = "git diff";
      gc = "git commit";
      gca = "git commit -a";
      gco = "git checkout";
      gb = "git branch";
      gs = "git status -sb";
      # super handy when working with lots of repos
      gsdir = ''for d in */; do cd $d && echo "$d" && git status -sb ; echo ; cd .. ; done'';
      pull = "git pull";
      ci = "git commit";
      st = "git status";
      fetch = "git fetch";
      push = "git push";
      # Two aliases for adding files. The first ignores delete files, the second
      # includes them.
      add = "git add --ignore-removal";
      ga = "git add -A";
    };
    profileExtra = ''
OLDPATH=$PATH
for DIR in \
  $HOME/bin            \
  $HOME/me/bin         \
  $HOME/.local/bin
do
  if [ -d $DIR ]
  then
    PATH=$DIR:$PATH
  fi
done
    '';
  };

  programs.emacs = {
    enable = true;
    extraPackages = epkgs: with epkgs; [
      ace-window
      ag
      avy
      bbdb
      cider
      circe
      clj-refactor
      clojure-mode
      company
      counsel
      counsel-dash
      counsel-projectile
      define-word
      diminish
      dired-narrow
      editorconfig
      emojify
      #eww
      #eww-lnum
      git-gutter-plus
      git-timemachine
      haskell-mode
      #hindent-mode
      hlint-refactor
      #hoon-mode
      #ibuffer
      ibuffer-vc
      #indent-guide-mode
      ivy
      #link-hint # FIXME
      lispy
      magit
      markdown-mode
      multiple-cursors
      neotree
      nix-mode
      nix-mode
      org-bullets
      org-plus-contrib
      org-pomodoro
      org-super-agenda
      org-trello
      pass
      projectile
      racket-mode
      restclient
      s
      shakespeare-mode
      #sky-color-clock
      smart-mode-line
      solarized-theme
      swiper
      sx
      undo-tree
      wakatime-mode
      which-key
      yaml-mode
      yasnippet
    ];
  };

  programs.vim = {
    enable = true;
    plugins = [
      "colors-solarized"
      "fugitive"
    ];
    settings = {
      ignorecase = true;
      expandtab = true;
      history = 1000;
      tabstop = 4;
    };
    extraConfig = ''
      " Auto-switch theme
      let hour = strftime("%H")
      if 6 <= hour && hour < 18
        set background=light
      else
        set background=dark
      endif
      colorscheme solarized
      filetype plugin indent on
      set cuc cul        " Crosshair
      set cc=80          " 80 column lines
      set linebreak      " Break lines at word (requires Wrap lines)
      set showbreak=+++  " Wrap-broken line prefix
      set textwidth=80   " Line wrap (number of cols)
      set showmatch      " Highlight matching brace
      set visualbell     " Use visual bell (no beeping)
      set hlsearch       " Highlight all search results
      set smartcase      " Enable smart-case search
      set incsearch      " Searches for strings incrementally
      ret autoindent     " Auto-indent new lines
      set shiftwidth=4   " Number of auto-indent spaces
      set smartindent    " Enable smart-indent
      set smarttab       " Enable smart-tabs
      set ruler          " Show row and column ruler information
      set backspace=indent,eol,start " Backspace behaviour
      imap fd <Esc>      " alternate escape
      set wildmenu       " cool menu effect
      set mouse=a
    '';
  };

  programs.firefox = {
    enable = true;
    enableIcedTea = true;
  };

  services.gpg-agent = {
    enable = true;
    defaultCacheTtl = 600;
    enableSshSupport = true;
  };

  programs.home-manager.enable = true;
  programs.home-manager.path = https://github.com/rycee/home-manager/archive/release-18.03.tar.gz;
}