about summary refs log tree commit diff
path: root/users/aspen/system/home/modules/development.nix
blob: 2695b0fc8816b67178ac323d5e135a16d032f658 (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
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
{ config, lib, pkgs, ... }:

let

  clj2nix = pkgs.callPackage
    (pkgs.fetchFromGitHub {
      owner = "hlolli";
      repo = "clj2nix";
      rev = "3ab3480a25e850b35d1f532a5e4e7b3202232383";
      sha256 = "1lry026mlpxp1j563qs13nhxf37i2zpl7lh0lgfdwc44afybqka6";
    })
    { };

  pg-dump-upsert = pkgs.buildGoModule rec {
    pname = "pg-dump-upsert";
    version = "165258deaebded5e9b88f7a0acf3a4b7350e7bf4";

    src = pkgs.fetchFromGitHub {
      owner = "tomyl";
      repo = "pg-dump-upsert";
      rev = version;
      sha256 = "1an4h8jjbj3r618ykjwk9brii4h9cxjqy47c4c8rivnvhimgf4wm";
    };

    vendorHash = "sha256:1a5fx6mrv30cl46kswicd8lf5i5shn1fykchvbnbhdpgxhbz6qi4";
  };

in

with lib;

{
  imports = [
    ./lib/zshFunctions.nix
    ./development/kube.nix
    # TODO(aspen): agda build is broken in the nixpkgs checkout
    # ./development/agda.nix
    ./development/rust.nix
  ];

  home.packages = with pkgs; [
    jq
    yq
    gron
    gitAndTools.tig
    gitAndTools.gh
    shellcheck
    httpie
    entr
    gnumake
    inetutils
    tokei
    jsonnet
    ngrok
    amber

    gdb
    lldb
    hyperfine
    clang-tools

    clj2nix
    clojure
    leiningen
    clj-kondo

    pg-dump-upsert

    nodePackages.prettier
  ] ++ optionals (stdenv.isLinux) [
    # TODO(aspen): replace with stable again once the current julia debacle
    # is resolved upstream, see https://github.com/NixOS/nixpkgs/pull/121114
    julia_16-bin
    valgrind

    linuxPackages.perf
    rr
  ];

  programs.git = {
    enable = true;
    package = pkgs.gitFull;
    userEmail = "root@gws.fyi";
    userName = "Aspen Smith";
    ignores = [
      "*.sw*"
      ".classpath"
      ".project"
      ".settings/"
      ".dir-locals.el"
      ".stack-work-profiling"
      ".projectile"
    ];
    extraConfig = {
      github.user = "glittershark";
      merge.conflictstyle = "diff3";
      rerere.enabled = "true";
      advice.skippedCherryPicks = "false";
    };

    delta = {
      enable = true;
      options = {
        syntax-theme = "Solarized (light)";
        hunk-style = "plain";
        commit-style = "box";
      };
    };
  };

  home.file.".gdbinit".text = ''
    set history filename ~/.gdb_history
    set history save on
    set history size unlimited
    set history remove-duplicates unlimited
    set history expansion on
  '';

  home.file.".psqlrc".text = ''
    \set QUIET 1

    \timing
    \set ON_ERROR_ROLLBACK interactive
    \set VERBOSITY verbose
    \x auto
    \set PROMPT1 '%[%033[1m%]%M/%/%R%[%033[0m%]%# '
    \set PROMPT2 '...%# '
    \set HISTFILE ~/.psql_history- :DBNAME
    \set HISTCONTROL ignoredups
    \pset null [null]

    \pset linestyle 'unicode'
    \pset unicode_border_linestyle single
    \pset unicode_column_linestyle single
    \pset unicode_header_linestyle double

    \unset QUIET
  '';

  programs.readline = {
    enable = true;
    extraConfig = ''
      set editing-mode vi
    '';
  };

  programs.zsh = {
    shellAliases = {
      # Git
      "gwip" = "git add . && git commit -am wip";
      "gpr" = "g pull-request";
      "gcl" = "git clone";
      "grs" = "gr --soft";
      "grhh" = "grh HEAD";
      "grh" = "gr --hard";
      "gr" = "git reset";
      "gcb" = "gc -b";
      "gco" = "gc";
      "gcd" = "gc development";
      "gcm" = "gc master";
      "gcc" = "gc canon";
      "gc" = "git checkout";
      "gbg" = "git branch | grep";
      "gba" = "git branch -a";
      "gb" = "git branch";
      "gcv" = "git commit --verbose";
      "gci" = "git commit";
      "gm" = "git merge";
      "gdc" = "gd --cached";
      "gd" = "git diff";
      "gsl" = "git stash list";
      "gss" = "git show stash";
      "gsad" = "git stash drop";
      "gsa" = "git stash";
      "gst" = "gs";
      "gs" = "git status";
      "gg" = "gl --decorate --oneline --graph --date-order --all";
      "gl" = "git log";
      "gf" = "git fetch";
      "gur" = "gu --rebase";
      "gu" = "git pull";
      "gpf" = "gp -f";
      "gpa" = "gp --all";
      "gpu" = "git push -u origin \"$(git symbolic-ref --short HEAD)\"";
      "gp" = "git push";
      "ganw" = "git diff -w --no-color | git apply --cached --ignore-whitespace";
      "ga" = "git add";
      "gnp" = "git --no-pager";
      "g" = "git";
      "grim" = "git fetch && git rebase -i --autostash origin/master";
      "grom" = "git fetch && git rebase --autostash origin/master";
      "groc" = "git fetch && git rebase --autostash origin/canon";
      "grc" = "git rebase --continue";
      "gcan" = "git commit --amend --no-edit";
      "grl" = "git reflog";

      # Haskell
      "crl" = "cabal repl";
      "cr" = "cabal run";
      "cnb" = "cabal new-build";
      "cob" = "cabal old-build";
      "cnr" = "cabal new-run";
      "cor" = "cabal old-run";
      "ho" = "hoogle";
    };

    functions = {
      gdelmerged = ''
        git branch --merged | egrep -v 'master' | tr -d '+ ' | xargs git branch -d
      '';

      gref = ''
        git show -s --pretty=reference "$1" | xclip -selection clipboard
      '';
    };
  };
}