This repository has been archived by the owner on Oct 12, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
shell.nix
136 lines (116 loc) · 3.22 KB
/
shell.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
# Shell configuration for zsh (frequently used) and fish (used just for fun)
{ config, lib, pkgs, ... }:
let
# Set all shell aliases programatically
shellAliases = {
# Aliases for commonly used tools
hm = "humioctl";
grep = "grep --color=auto";
circleci = "circleci-cli";
just = "just --no-dotenv";
diff = "diff --color=auto";
iex = "iex --dot-iex ~/.iex.exs";
hk = "heroku";
cat = "bat";
we = "watchexec";
find = "fd";
cloc = "tokei";
l = "exa";
ll = "ls -lh";
ls = "exa";
dk = "docker";
k = "kubectl";
dc = "docker-compose";
bazel = "bazelisk";
md = "mdcat";
mk = "minikube";
start-docker = "docker-machine start default";
tf = "terraform";
hms = "home-manager switch";
# Reload zsh
szsh = "source ~/.zshrc";
# Reload home manager and zsh
reload = "home-manager switch && source ~/.zshrc";
# Nix garbage collection
garbage = "nix-collect-garbage -d && docker image prune --force";
# See which Nix packages are installed
installed = "nix-env --query --installed";
};
in {
# Fancy filesystem navigator
programs.broot = {
enable = true;
enableFishIntegration = true;
enableZshIntegration = true;
};
# fish shell settings
programs.fish = {
inherit shellAliases;
enable = true;
};
#programs.fzf = {
# enable = true;
# enableBashIntegration = true;
# defaultCommand = "${pkgs.ripgrep}/bin/rg --files";
#};
# zsh settings
programs.zsh = {
inherit shellAliases;
enable = true;
enableAutosuggestions = true;
enableCompletion = true;
history.extended = true;
# Called whenever zsh is initialized
initExtra = ''
export TERM="xterm-256color"
bindkey -e
# Nix setup (environment variables, etc.)
if [ -e ~/.nix-profile/etc/profile.d/nix.sh ]; then
. ~/.nix-profile/etc/profile.d/nix.sh
fi
# Load environment variables from a file; this approach allows me to not
# commit secrets like API keys to Git
if [ -e ~/.env ]; then
. ~/.env
fi
# Start up Starship shell
eval "$(starship init zsh)"
# Autocomplete for various utilities
source <(helm completion zsh)
source <(kubectl completion zsh)
source <(linkerd completion zsh)
source <(doctl completion zsh)
source <(minikube completion zsh)
source <(gh completion --shell zsh)
rustup completions zsh > ~/.zfunc/_rustup
source <(cue completion zsh)
source <(npm completion zsh)
source <(humioctl completion zsh)
source <(fluxctl completion zsh)
# direnv setup
eval "$(direnv hook zsh)"
# Start up Docker daemon if not running
if [ $(docker-machine status default) != "Running" ]; then
docker-machine start default
fi
# Docker env
eval "$(docker-machine env default)"
# Load asdf
. $HOME/.asdf/asdf.sh
# direnv hook
eval "$(direnv hook zsh)"
'';
# Disable oh my zsh in favor of Starship shell
#oh-my-zsh = {
# enable = true;
# plugins = [
# "docker"
# "docker-compose"
# "dotenv"
# "git"
# "sudo"
# ];
# theme = "muse";
#};
};
}