-
Notifications
You must be signed in to change notification settings - Fork 12
/
home.nix
254 lines (230 loc) · 6.48 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
{ config, lib, pkgs, specialArgs, ... }:
let
bashsettings = import ./bash.nix pkgs;
vimsettings = import ./vim.nix;
packages = import ./packages.nix;
# hacky way of determining which machine I'm running this from
inherit (specialArgs) withGUI isDesktop networkInterface;
inherit (lib) mkIf;
inherit (pkgs.stdenv) isLinux isDarwin;
in
{
nixpkgs.config.allowUnfree = true;
nixpkgs.overlays = [ ];
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
home.packages = packages pkgs withGUI;
home.homeDirectory = "/home/jon";
home.username = "jon";
home.stateVersion = "21.11";
home.file.".config/nvim/coc-settings.json".source = ./coc-settings.json;
home.file.".config/polybar/pipewire.sh" = mkIf withGUI {
source = pkgs.callPackage ./nix/polybar.nix { };
executable = true;
};
services.polybar = mkIf withGUI {
enable = true;
package = pkgs.polybarFull;
config = pkgs.substituteAll {
src = ./polybar-config;
interface = networkInterface;
};
script = ''
for m in $(polybar --list-monitors | ${pkgs.coreutils}/bin/cut -d":" -f1); do
export MONITOR="$m"
polybar nord &
done
'';
};
services.lorri.enable = isLinux;
services.pulseeffects.enable = false;
services.pulseeffects.preset = "vocal_clarity";
services.gpg-agent.enable = isLinux;
services.gpg-agent.enableExtraSocket = withGUI;
services.gpg-agent.enableSshSupport = isLinux;
programs.alacritty = (import ./alacritty.nix) withGUI;
programs.bash = bashsettings;
programs.neovim = vimsettings pkgs;
programs.direnv.enable = true;
programs.htop = {
enable = true;
settings = {
left_meters = [ "LeftCPUs2" "Memory" "Swap" ];
left_right = [ "RightCPUs2" "Tasks" "LoadAverage" "Uptime" ];
setshowProgramPath = false;
treeView = true;
};
};
programs.jq.enable = true;
programs.ssh = {
enable = true;
forwardAgent = true;
extraConfig = ''
Include ~/.ssh/config.d/*
Host mac
HostName 10.0.0.236
Port 22
IdentityFile /home/jon/.ssh/id_rsa
ForwardAgent yes
User jon
ServerAliveInterval 60
RemoteForward /run/user/1000/gnupg/S.gpg-agent /run/user/1000/gnupg/S.gpg-agent.extra
Host build
HostName 10.0.0.21
Port 22
IdentityFile /home/jon/.ssh/id_rsa
User root
Host external
HostName jonringer.us
Port 2222
IdentityFile /home/jon/.ssh/id_rsa
ForwardAgent yes
User jon
RemoteForward /run/user/1000/gnupg/S.gpg-agent /run/user/1000/gnupg/S.gpg-agent.extra
Host server
HostName 10.0.0.21
Port 22
IdentityFile /home/jon/.ssh/id_rsa
User jon
Host pi
HostName 10.0.0.220
Port 22
IdentityFile /home/jon/.ssh/id_rsa
User jon
RemoteForward /run/user/1000/gnupg/S.gpg-agent /run/user/1000/gnupg/S.gpg-agent.extra
Host *
ForwardAgent yes
AddKeysToAgent yes
'';
};
programs.fzf.enable = true;
programs.vscode = mkIf withGUI {
enable = true;
package = pkgs.vscode-fhsWithPackages (pkgs: with pkgs; [ zlib rustup ]);
#extensions = with pkgs.vscode-extensions; [
# vscodevim.vim
# ms-python.python
#];
};
programs.git = {
enable = true;
lfs.enable = true;
userName = "Jonathan Ringer";
userEmail = "[email protected]";
signing = {
key = "5C841D3CFDFEC4E0";
signByDefault = false;
};
aliases = {
a = "add";
c = "commit";
ca = "commit --amend";
can = "commit --amend --no-edit";
cl = "clone";
cm = "commit -m";
co = "checkout";
cp = "cherry-pick";
cpx = "cherry-pick -x";
d = "diff";
f = "fetch";
fo = "fetch origin";
fu = "fetch upstream";
lol = "log --graph --decorate --pretty=oneline --abbrev-commit";
lola = "log --graph --decorate --pretty=oneline --abbrev-commit --all";
pl = "pull";
pr = "pull -r";
ps = "push";
psf = "push -f";
rb = "rebase";
rbi = "rebase -i";
r = "remote";
ra = "remote add";
rr = "remote rm";
rv = "remote -v";
rs = "remote show";
st = "status";
};
extraConfig = {
merge = {
tool = "vimdiff";
conflictstyle = "diff3";
};
pull = {
rebase=true;
};
mergetool.prompt = "false";
git.path = toString pkgs.git;
};
includes = [
# use different signing key
{
condition = "gitdir:~/work/";
contents = {
user = {
name = "Jonathan Ringer";
email = "[email protected]";
signingKey = "7B8CFA0F33328D9A";
};
};
}
# prevent background gc thread from constantly blocking reviews
{
condition = "gitdir:~/projects/nixpkgs";
contents = {
gc.auto = 0;
fetch.prune = false;
};
}
];
};
xdg.enable = true;
programs.obs-studio = {
enable = withGUI;
plugins = with pkgs.obs-studio-plugins; [
wlrobs
obs-backgroundremoval
obs-pipewire-audio-capture
];
};
xsession = mkIf withGUI {
enable = true;
windowManager.i3 = rec {
enable = true;
package = pkgs.i3-gaps;
config = {
modifier = "Mod4";
bars = [ ]; # use polybar instead
gaps = {
inner = 12;
outer = 5;
smartGaps = true;
smartBorders = "off";
};
startup = [
{ command = "exec firefox"; }
{ command = "exec steam"; }
{ command = "exec Discord"; }
] ++ lib.optionals isDesktop [
{ command = "xrand --output HDMI-0 --right-of DP-4"; notification = false; }
] ++ [
# allow polybar to resize itself
{ command = "systemctl --user restart polybar"; always = true; notification = false; }
];
assigns = {
"2: web" = [{ class = "^Firefox$"; }];
"4" = [{ class = "^Steam$"; }];
"6" = [{ class = "HexChat$"; }];
"7" = [{ class = "^Discord$"; }];
};
keybindings = import ./i3-keybindings.nix config.modifier;
};
extraConfig = ''
for_window [class="^.*"] border pixel 2
#exec systemctl --user import-environment
'' + lib.optionalString isDesktop ''
workspace "2: web" output HDMI-0
workspace "7" output HDMI-0
'';
};
};
}