-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.nix
240 lines (216 loc) · 6.43 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
{ config, ... }:
let
username = builtins.getEnv "USER";
homeDir = builtins.getEnv "HOME";
# Currently I have fixated this to $HOME/simontheleg/dotfiles to sync it across multiple machines and/or
# multiple users per machine, as it only comes with the limitation to always clone the repository into
# that directory
dotFilesDir = "${homeDir}/simontheleg/dotfiles";
# pin stable and unstable channels to specific commits
nixstablecommit = "9370544d849be8a07193e7611d02e6f6f1b10768";
nixunstablecommit = "ced197be72099edcfa68ebed8b87af7b04851f45"; # 01.11.2022
pkgs = import (builtins.fetchGit {
name = "nixpkgs-stable";
url = "https://github.com/nixos/nixpkgs.git";
ref = "refs/heads/nixpkgs-22.05-darwin";
rev = "${nixstablecommit}";
}) { config = { allowUnfree = true; }; };
pkgs_unstable = import (builtins.fetchGit {
name = "nixpkgs-unstable";
url = "https://github.com/nixos/nixpkgs.git";
ref = "refs/heads/nixpkgs-unstable";
rev = "${nixunstablecommit}";
}) {
config = { allowUnfree = true; };
overlays = [
(self: super: {
})
];
};
in {
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
# Home Manager needs a bit of information about you and the
# paths it should manage.
home.username = username;
home.homeDirectory = homeDir;
# This value determines the Home Manager release that your
# configuration is compatible with. This helps avoid breakage
# when a new Home Manager release introduces backwards
# incompatible changes.
#
# You can update Home Manager without changing this value. See
# the Home Manager release notes for a list of state version
# changes in each release.
home.stateVersion = "21.05";
home.packages = with pkgs_unstable; [
apg
azure-cli
bash
bat
cachix
dhall-lsp-server
diff-so-fancy
direnv
dive
exa
fzf
gettext
gh
git
git-sizer
gnugrep
gnupg
gnused
gopass
gradle
istioctl
jq
json2hcl
kubectl
librsvg
lorri
minikube
moreutils
mtr
mycli
neovim
niv
nnn
postgresql
protobuf
putty
pwgen
redis
ripgrep
shellcheck
silver-searcher
sox
stack
starship
stern
terraform
terraform-docs
terraform-ls
tmux
tree
vim
watch
wget
nix-prefetch-github
ngrok
git-open
scmpuff
google-cloud-sdk
google-clasp
awscli2
operator-sdk
kubernetes-helm
kind
fluxcd
zsh-z
kustomize
asciinema
vault
yq-go
prometheus
kubebuilder
htop
sops
krew
sonobuoy
act
findutils
bash-completion
imagemagick
gifsicle
pv
coreutils
grpcurl
git-filter-repo
nixfmt
python310
k9s
highlight
graphviz
goreleaser
minio-client
rakkess
k9s
];
# for future Simon: if I ever need more than one channel as source, here's how to do it https://discourse.nixos.org/t/nix-env-i-runs-out-of-memory-with-unstable-overlay/1517/3
home.file = {
".zprofile".source = "${dotFilesDir}/.zprofile";
".tmux.conf".source = "${dotFilesDir}/.tmux.conf";
".vimrc".source = "${dotFilesDir}/.vimrc";
".gitconfig".source = "${dotFilesDir}/.gitconfig";
".config/starship.toml".source = config.lib.file.mkOutOfStoreSymlink
"${dotFilesDir}/starship.toml"; # mkOutOfStoreSymlink is needed so starship can write into the file
".config/nvim/init.vim".source = "${dotFilesDir}/init.vim";
".kube/kubie.yaml".source = "${dotFilesDir}/kubie.yaml";
".goenv/".source = pkgs.fetchFromGitHub {
owner = "syndbg";
repo = "goenv";
rev = "4beb4808bf597c935264a45787fb29b1ce967bbb";
sha256 = "sha256-Pm+eef5RlRkmi2C3jBd0AHelgbmNdOpO3E61K4h6vhk=";
};
".tmux/plugins/tpm".source = config.lib.file.mkOutOfStoreSymlink
(pkgs.fetchFromGitHub {
owner = "tmux-plugins";
repo = "tpm";
rev = "v3.0.0";
sha256 = "sha256-qYBMDLIEkgiTFxjlF8AHn31HZ4nt/ZoeerzX70SSBaM=";
});
"Library/Application Support/k9s/skin.yml".source = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/derailed/k9s/v0.27.4/skins/one_dark.yml";
sha256 = "sha256-527BS3aU+2MmbnHXNzCYQ1b47cDistd5+2xuIXUQmpU=";
};
".local/share/nvim/site/autoload/plug.vim".source = pkgs.fetchurl {
url =
"https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim";
sha256 = "sha256-VgaLrLphI8TsVB85iJM/3cf5wee0+bCmfzrZPf1t9L4=";
};
".iterm2_shell_integration.zsh".source = pkgs.fetchurl {
url = "https://iterm2.com/shell_integration/zsh";
sha256 = "sha256-pNn1unJyAU8QihQoHV7aIZA1s2iyloAG9hdV19/zaMA=";
};
".rupaz/z.sh".source = pkgs.fetchurl {
url = "https://raw.githubusercontent.com/rupa/z/v1.11/z.sh";
sha256 = "sha256-8k4HkboQ9qgwFGHaP8UDM+7i4Amhnl0OnzZh8NBEZ2c=";
};
};
programs.zsh = {
enable = true;
localVariables = {
# disable escape when pasting urls. See https://stackoverflow.com/questions/25614613/how-to-disable-zsh-substitution-autocomplete-with-url-and-backslashes
DISABLE_MAGIC_FUNCTIONS = ["true"];
};
initExtra = builtins.readFile "${dotFilesDir}/.zshrc";
oh-my-zsh = { enable = true; };
# For now I have given up on managing all plugins and autocompletions via the zsh nix module. Reasons are:
# - it seems really tough install completion packages. e.g. terraform has its own completions, which is not managed by the plugin it self (see https://github.com/ohmyzsh/ohmyzsh/blob/master/plugins/terraform. And I could not find a way to install this
# For future Simon. You can use the `nix-prefetch-github --nix <gh-owner> <gh-repo> --rev <desired-git-ref>` command to find the revs and shas
plugins = [
{
name = "zsh-autosuggestions";
file = "zsh-autosuggestions.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-autosuggestions";
rev = "v0.7.0";
sha256 = "KLUYpUu4DHRumQZ3w59m9aTW6TBKMCXl2UcKi4uMd7w=";
};
}
{
name = "zsh-syntax-highlighting";
file = "zsh-syntax-highlighting.plugin.zsh";
src = pkgs.fetchFromGitHub {
owner = "zsh-users";
repo = "zsh-syntax-highlighting";
rev = "0.7.0";
sha256 = "sha256-eRTk0o35QbPB9kOIV0iDwd0j5P/yewFFISVS/iEfP2g=";
};
}
];
};
}