-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.nix
336 lines (301 loc) · 11 KB
/
home.nix
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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
{ config, pkgs, lib, ... }:
{
home.stateVersion = "22.05";
xdg.enable = true;
# home.sessionVariables = {
# LANG = "en_US.UTF-8";
# LC_CTYPE = "en_US.UTF-8";
# LC_ALL = "en_US.UTF-8";
# EDITOR = "nvim";
# PAGER = "less -FirSwX";
# MANPAGER = "sh -c 'col -bx | ${pkgs.bat}/bin/bat -l man -p'";
# };
# # https://github.com/malob/nixpkgs/blob/master/home/default.nix
# # Direnv, load and unload environment variables depending on the current directory.
# # https://direnv.net
# # https://rycee.gitlab.io/home-manager/options.html#opt-programs.direnv.enable
programs.direnv.enable = true;
programs.direnv.nix-direnv.enable = true;
# Htop
# https://rycee.gitlab.io/home-manager/options.html#opt-programs.htop.enable
programs.htop.enable = true;
programs.htop.settings.show_program_path = true;
# Starship Prompt
# https://rycee.gitlab.io/home-manager/options.html#opt-programs.starship.enable
programs.starship.enable = true;
programs.zoxide = {
enable = true;
};
programs.fzf = {
enable = true;
enableFishIntegration = false;
};
programs.bat.enable = true;
programs.starship.settings = {
# See docs here: https://starship.rs/config/
# Symbols config configured ./starship-symbols.nix.
directory.fish_style_pwd_dir_length = 1; # turn on fish directory truncation
directory.truncation_length = 2; # number of directories not to truncate
gcloud.disabled = true; # annoying to always have on
hostname.style = "bold green"; # don't like the default
memory_usage.disabled = true; # because it includes cached memory it's reported as full a lot
username.style_user = "bold blue"; # don't like the default
};
programs.fish = {
enable = true;
interactiveShellInit = lib.strings.concatStrings (lib.strings.intersperse "\n" [
# "source ${sources.theme-bobthefish}/functions/fish_prompt.fish"
# "source ${sources.theme-bobthefish}/functions/fish_right_prompt.fish"
# "source ${sources.theme-bobthefish}/functions/fish_title.fish"
# (builtins.readFile ./conf.fish)
"set -g SHELL ${pkgs.fish}/bin/fish"
# set -gx fish_user_paths $HOME/go/bin $HOME/.cargo/bin
# "set -g theme_nerd_fonts yes"
# "set -g theme_newline_cursor yes"
"set -gx FZF_DEFAULT_COMMAND 'fd --type file'"
"set -gx FZF_CTRL_T_COMMAND $FZF_DEFAULT_COMMAND"
"set -gx FZF_ALT_C_COMMAND fd -t d . $HOME"
"set fzf_preview_dir_cmd eza --all --color=always"
"set -gx EDITOR nvim"
# To deal with fish not ordering the nix paths first https://github.com/LnL7/nix-darwin/issues/122
"fish_add_path --move --prepend --path $HOME/.nix-profile/bin /run/wrappers/bin /etc/profiles/per-user/$USER/bin /nix/var/nix/profiles/default/bin /run/current-system/sw/bin $HOME/.bun/bin"
"fzf_configure_bindings"
]);
shellAliases = {
ga = "git add";
gc = "git commit";
gco = "git checkout";
gcp = "git cherry-pick";
gdiff = "git diff";
gl = "git prettylog";
gp = "git push";
gs = "git status";
gt = "git tag";
# Two decades of using a Mac has made this such a strong memory
# that I'm just going to keep it consistent.
pbcopy = "xclip";
pbpaste = "xclip -o";
wo = "cd ~/Developer/workspace";
ll = "eza -l -g --icons";
la = "${pkgs.eza}/bin/eza -a";
lt = "${pkgs.eza}/bin/eza --tree";
lla = "${pkgs.eza}/bin/eza -la";
pn = "pnpm ";
};
plugins = [
{
name = "fzf-fish";
src = pkgs.fetchFromGitHub {
owner = "PatrickF1";
repo = "fzf.fish";
rev = "c8c7d9903e0327b0d76e51ba4378ec8d5ef6477e";
sha256 = "0v653v5g3fnnlbar8ljrclf0qpn4fp4r8flqi7pfypqm0nv8zf9q";
};
}
];
};
programs.eza.enable = true;
programs.jq.enable = true;
programs.lsd.enable = true;
programs.feh.enable = true;
home.packages = [
pkgs.fd
pkgs.git-crypt
pkgs.ripgrep
pkgs.tree
pkgs.watch
pkgs.zathura
pkgs.go
pkgs.gopls
pkgs.tetex
pkgs.delta
pkgs.du-dust
pkgs.duf
pkgs.broot
pkgs.cheat
pkgs.tldr
pkgs.bottom
pkgs.glances
pkgs.gtop
pkgs.gping
# pkgs.procs
pkgs.dogdns
# pkgs.neofetch
pkgs.nmap
pkgs.gcc
pkgs.wget
pkgs.unzip
pkgs.luajit
pkgs.luajitPackages.luacheck
pkgs.luajitPackages.gitsigns-nvim
pkgs.statix
pkgs.nodejs
# pkgs.nerdfonts
pkgs.diff-so-fancy
pkgs.nodePackages.yarn
pkgs.nodePackages.eslint
pkgs.nodePackages.prettier
pkgs.nodePackages.pnpm
pkgs.tree-sitter
pkgs.fishPlugins.foreign-env
pkgs.fishPlugins.done
pkgs.awscli2
pkgs.aws-vault
# pkgs.nodePackages_latest.aws-cdk
];
# Misc configuration files --------------------------------------------------------------------{{{
# https://docs.haskellstack.org/en/stable/yaml_configuration/#non-project-specific-config
# home.file.".stack/config.yaml".text = lib.generators.toYAML {} {
# templates = {
# scm-init = "git";
# params = {
# author-name = "Your Name"; # config.programs.git.userName;
# author-email = "youremail@example.com"; # config.programs.git.userEmail;
# github-username = "yourusername";
# };
# };
# nix.enable = true;
# };
programs.kitty = {
enable = true;
extraConfig = builtins.readFile ./kitty;
};
xdg.configFile."nvim/lua/base.lua".source = ./base.lua;
programs.neovim = {
enable = true;
package = pkgs.neovim-unwrapped;
viAlias = true;
vimAlias = true;
plugins = with pkgs; [
vimPlugins.which-key-nvim
vimPlugins.plenary-nvim
vimPlugins.popup-nvim
vimPlugins.telescope-nvim
vimPlugins.telescope-fzf-native-nvim
vimPlugins.telescope-file-browser-nvim
(vimPlugins.nvim-treesitter.withPlugins (_: pkgs.tree-sitter.allGrammars))
# vimPlugins.nvim-treesitter
vimPlugins.nvim-treesitter-textobjects
vimPlugins.nvim-treesitter-refactor
vimPlugins.nvim-treesitter-context
vimPlugins.playground
vimPlugins.nvim-lspconfig
vimPlugins.lsp-status-nvim
vimPlugins.null-ls-nvim
vimPlugins.trouble-nvim
vimPlugins.nvim-cmp
vimPlugins.cmp-nvim-lsp
vimPlugins.cmp-buffer
vimPlugins.cmp-path
vimPlugins.cmp-cmdline
vimPlugins.cmp-treesitter
vimPlugins.cmp-spell
vimPlugins.cmp_luasnip
vimPlugins.luasnip
vimPlugins.lualine-nvim
vimPlugins.kanagawa-nvim
vimPlugins.nvim-web-devicons
vimPlugins.vim-startify
vimPlugins.neoformat
vimPlugins.catppuccin-nvim
];
# extraConfig = (import ./vim-config.nix) { inherit sources; };
extraConfig = ''
lua require('base')
'';
extraPackages = with pkgs; [
# Language server packages (executables)
rnix-lsp
sumneko-lua-language-server
nodePackages.vim-language-server
stylua
nixfmt
rustfmt
];
};
programs.git = {
enable = true;
userName = "Chris Handy";
userEmail = "chrisjhandy@gmail.com";
aliases = {
prettylog = "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(r) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative";
root = "rev-parse --show-toplevel";
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = "log --pretty=oneline -n 20 --graph --abbrev-commit";
# View the current working tree status using the short formats
s = "status -s";
# Show the diff between the latest commit and the current state
d = "!git diff-index --quiet HEAD -- || clear; git --no-pager diff --patch-with-stat";
# `git di $number` shows the diff between the state `$number` revisions ago and the current state
di = "!d() { git diff --patch-with-stat HEAD~$1; }; git diff-index --quiet HEAD -- || clear; d";
# Using diff-so-fancy
dsf = "!git diff --color $@ | diff-so-fancy";
# Pull in remote changes for the current repository and all its submodules
p = "!git pull; git submodule foreach git pull origin master";
# Clone a repository including all submodules
c = "clone --recursive";
# Commit all changes
ca = "!git add -A && git commit -av";
# Switch to a branch, creating it if necessary
go = "!f() { git checkout -b \"$1\" 2> /dev/null || git checkout \"$1\"; }; f";
# Show verbose output about tags, branches or remote
tags = "tag -l";
branches = "branch -a";
remotes = "remote -v";
# Amend the currently staged files to the latest commit
amend = "commit --amend --reuse-message=HEAD";
# Credit an author on the latest commit
credit = "!f() { git commit --amend --author \"$1 <$2>\" -C HEAD; }; f";
# Interactive rebase with the given number of latest commits
reb = "!r() { git rebase -i HEAD~$1; }; r";
# Remove the old tag with this name and tag the latest commit with it.
retag = "!r() { git tag -d $1 && git push origin :refs/tags/$1 && git tag $1; }; r";
# Find branches containing commit
fb = "!f() { git branch -a --contains $1; }; f";
# Find tags containing commit
ft = "!f() { git describe --always --contains $1; }; f";
# Find commits by source code
fc = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short -S$1; }; f";
# Find commits by commit message
fm = "!f() { git log --pretty=format:'%C(yellow)%h %Cblue%ad %Creset%s%Cgreen [%cn] %Cred%d' --decorate --date=short --grep=$1; }; f";
};
extraConfig = {
branch.autosetuprebase = "always";
color.ui = true;
core.askPass = ""; # needs to be empty to use terminal for ask pass
credential.helper = "store"; # want to make this more secure
github.user = "chandy";
push.default = "tracking";
init.defaultBranch = "main";
};
};
# Apps
# `home-manager` currently has issues adding them to `~/Applications`
# Issue: https://github.com/nix-community/home-manager/issues/1341
# home.activation = lib.mkIf pkgs.stdenv.isDarwin {
# copyApplications =
# let
# apps = pkgs.buildEnv {
# name = "home-manager-applications";
# paths = config.home.packages;
# pathsToLink = "/Applications";
# };
# in
# lib.hm.dag.entryAfter [ "writeBoundary" ] ''
# baseDir="$HOME/Applications/Home Manager Apps"
# echo "hm 1"
# if [ -d "$baseDir" ]; then
# echo "hm rm 1"
# rm -rf "$baseDir"
# fi
# echo "hm 2"
# mkdir -p "$baseDir"
# echo "hm 3"
# for appFile in ${apps}/Applications/*; do
# target="$baseDir/$(basename "$appFile")"
# $DRY_RUN_CMD cp ''${VERBOSE_ARG:+-v} -fHRL "$appFile" "$baseDir"
# $DRY_RUN_CMD chmod ''${VERBOSE_ARG:+-v} -R +w "$target"
# done
# '';
# };
}