-
Notifications
You must be signed in to change notification settings - Fork 0
/
home.nix
306 lines (266 loc) · 8.06 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
{ pkgs, config, ... }:
let
packages = with pkgs; {
/* some packages are better installed via system pacman, e.g.
- zsh: better be under root to be set the default shell
- neovim: as the editor for sudoedit
- nix: the daemon
these can be managed with `system-manager` once it stabilizes.
*/
os.basic = [
## <nixpkgs> pkgs/stdenv/generic/common-path.nix
coreutils util-linux findutils diffutils iputils
gnused gnugrep gnumake
which tree file procps less
];
nix.basic = [
config.nix.package # manage itself ## daemon managed by root
cachix
nix-tree
nix-diff
];
nix.dev = [
nil # language server
nixpkgs-fmt # the unofficial formatter
nixfmt-rfc-style # the official formatter
nurl # generate fetcher call
nix-init # generate package
nix-update
nix-output-monitor
nixpkgs-hammering
nixpkgs-review
# hydra-check
system-manager # to be stabilized
# nixd # future lsp ## not stable # needs llvmPackages.llvm.lib
# nvd # version diff
];
cli.basic = [
neovim
jq
bat
fzf
byobu-with-tmux
diff-so-fancy
shellcheck
git
chezmoi
age
fd
progress
tldr
zoxide
lsof
wget
trash-cli
git-branchless
dust
bottom
jujutsu
faketty
stdoutisatty # from nixpkgs-config
openssh # need to unset SSH_AUTH_SOCK, maybe
# trashy # better, but its zsh completion is broken
proxychains
# (binaryFallback "proxychains4" proxychains-ng)
(writeShellScriptBin "proxychains" ''exec proxychains4 "$@"'')
(binaryFallback "aria2c" aria2)
];
cli.dev = [
mosh
difftastic
jc
rustup
mold # linker for non-nix projects; for nix, use `mold-wrapped`
cargo-binstall # then `cargo binstall cargo-quickinstall`
cargo-tarpaulin # show test coverage
nodejs # required by coc.nvim
watchman # as git fsmonitor
# mise # dev runtime manager
# evcxr # too heavy, instead `cargo quickinstall evcxr_repl`
# getoptions # shell argument parser
# diffoscopeMinimal # too heavy, use distro package instead
# devbox # cool but I am mostly using vanilla nix flake
];
cli.app = [
gh
circumflex # hacker news terminal
uxplay # airplay server
tectonic tectonic.biber
fuse-overlayfs
inetutils # telnet
grammarly-languageserver
dufs # file server
];
cli.python = let
inherit python3Packages;
/* <nixpkgs> pkgs/top-level/aliases.nix
pythonPackages = python.pkgs;
python = python2;
*/
in [
### do NOT expose python itself for safety reasons
python3Packages.ipython
python3Packages.jedi-language-server
ruff-lsp ruff # exposes `ruff`
poetry
pipx
];
gui.app = [
xorg.xinput
pulsar # atom fork
gimp-with-plugins
nixgl.nixGLIntel
nixgl.nixVulkanIntel
zed-editor
(writeShellApplication {
name = "zed";
runtimeInputs = [
zed-editor
nixgl.nixVulkanIntel
];
text = ''exec -a zed nixVulkanIntel zed "$@"'';
meta.priority = (zed-editor.meta.priority or 5) - 1;
# override the original zed binary
})
texstudio-lazy_resize # fork from nixpkgs-config
## vscode dummy:
(binaryFallback "code" (writeShellScriptBin "code" ''exec echo "$@"''))
];
};
in {
imports = [
./modules/redshift-many
./modules/v2ray-ctrl
./modules/nixpkgs-helpers
./modules/flake-channels.nix
./modules/home-setup.nix
## ^ process & pass home attrs with basic setup
];
home.packages = with packages;
os.basic ++
nix.basic ++
nix.dev ++
cli.basic ++
cli.dev ++
cli.app ++
cli.python ++
gui.app ++
[
## It is sometimes useful to fine-tune packages, for example, by applying
## overrides. You can do that directly here, just don't forget the
## parentheses:
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
## You can also create simple shell scripts directly inside your
## configuration. For example, this adds a command 'my-hello' to your
## environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
];
programs.v2ray-ctrl = {
# enable = false;
outbounds = "la6";
# routings =
# "private-direct,cn-direct,tencent-direct,ms-transit,zoom-transit";
};
services.redshift-many = {
redshift = {
settings.randr.crtc = 0;
temperature.always = 3200;
};
redshift-ext = {
settings.randr.crtc = 1;
temperature.always = 3600;
# temperature.always = 4800;
};
};
programs.xrandr-brightness = {
output = "DP-1";
# output = "HDMI-1";
};
programs.nixpkgs-helpers = {
viewer = "echo code --goto";
# flakeref = "nixpkgs";
};
programs.direnv = {
enable = true;
nix-direnv.enable = true;
# stdlib = "";
};
programs.man = {
enable = true; ## `disable` to use system manpage
};
disabledModules = [
## https://github.com/nix-community/home-manager/issues/2333
## https://github.com/nix-community/home-manager/blob/master/modules/config/i18n.nix
## use system locale; see `sessionVariables`
"config/i18n.nix"
];
## nix settings
## must set for `nix.settings` and stuff
nix.package = pkgs.nixVersions.nix_2_24;
nix.settings = {
max-jobs = "auto";
fallback = true;
## invalidate negative cache hits in 10min
## to invalidate all, pass `--option narinfo-cache-negative-ttl 0`
narinfo-cache-negative-ttl = 600;
## need to set `trusted-users = @wheel` in `/etc/nix/nix.conf`
# tarball-ttl = 4294967295;
auto-optimise-store = true;
extra-substituters = [ ## with `?priority`
"https://mirrors.tuna.tsinghua.edu.cn/nix-channels/store?priority=20"
# "https://mirror.sjtu.edu.cn/nix-channels/store?priority=20"
## cachix use nix-community -O .
"https://chezbryan.cachix.org"
"https://nix-community.cachix.org"
];
extra-trusted-public-keys = [
"chezbryan.cachix.org-1:4n1STyrAtSfRth4sbgUCKfgjtgR8yIy40jIV829Lfow="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
home.file = {
## Building this configuration will create a copy of 'dotfiles/screenrc' in
## the Nix store. Activating the configuration will then make '~/.screenrc' a
## symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
## You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
# You can also manage environment variables but you will have to manually
# source
#
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# /etc/profiles/per-user/bryan/etc/profile.d/hm-session-vars.sh
#
# if you don't want to manage your shell through Home Manager.
home.sessionVariables = {
## use system locale; see `disabledModules`
LOCALE_ARCHIVE = "/usr/lib/locale/locale-archive";
# EDITOR = "nvim";
# NIX_PATH = "nixpkgs=${pkgs.outPath}";
};
# 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 should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "22.11"; # Please read the comment before changing.
## does not work well with non-nix host
# i18n.inputMethod = {
# enabled = "fcitx5";
# fcitx5.addons = with pkgs; [
# ## https://github.com/NixOS/nixpkgs/blob/master/pkgs/tools/inputmethods/fcitx5/with-addons.nix
# fcitx5-chinese-addons
# ];
# };
}