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
| { pkgs, ... }: {
programs.zsh = {
enable = true;
history = {
size = 10000;
path = "$HOME/.zsh_history";
};
enableCompletion = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
shellAliases = {
ping = "ping -O";
killall = "killall -v";
umount = "umount -v";
lsblk = "lsblk -a --output 'NAME,LABEL,FSTYPE,SIZE,FSUSE%,RO,TYPE,MOUNTPOINTS'";
chmod = "chmod -v";
chown = "chown -v";
chattr = "chattr -v";
ln = "ln -v";
cp = "cp -v";
mv = "mv -v";
rm = "rm -v";
mkdir = "mkdir -pv";
rmdir = "rmdir -v";
myupdateVM1 = "sudo nixos-rebuild switch --show-trace --flake '/home/yh/workspace/nixos-config#vm-nixos' --option substituters https://mirror.sjtu.edu.cn/nix-channels/store";
myupdateVM2 = "sudo nixos-rebuild switch --show-trace --flake '/home/yh/workspace/nixos-config#vm-nixos' --option substituters https://mirrors.cernet.edu.cn/nix-channels/store";
myupdateB150m1 = "sudo nixos-rebuild switch --show-trace --flake '/home/yh/workspace/nixos-config#b150m' --option substituters https://mirror.sjtu.edu.cn/nix-channels/store";
myupdateB150m2 = "sudo nixos-rebuild switch --show-trace --flake '/home/yh/workspace/nixos-config#b150m' --option substituters https://mirrors.cernet.edu.cn/nix-channels/store";
myupdateThinkBook1 = "sudo nixos-rebuild switch --show-trace --flake '/home/yh/workspace/nixos-config#thinkbook' --option substituters https://mirror.sjtu.edu.cn/nix-channels/store";
myupdateThinkBook2 = "sudo nixos-rebuild switch --show-trace --flake '/home/yh/workspace/nixos-config#thinkbook' --option substituters https://mirrors.cernet.edu.cn/nix-channels/store";
myupdateX240-1 = "sudo nixos-rebuild switch --show-trace --flake '/home/yh/workspace/nixos-config#x240' --option substituters https://mirror.sjtu.edu.cn/nix-channels/store";
myupdateX240-2 = "sudo nixos-rebuild switch --show-trace --flake '/home/yh/workspace/nixos-config#x240' --option substituters https://mirrors.cernet.edu.cn/nix-channels/store";
myupdateBaseDesktop1 = "sudo nixos-rebuild switch --show-trace --flake '/home/yh/workspace/nixos-config#baseDesktop' --option substituters https://mirror.sjtu.edu.cn/nix-channels/store";
myupdateBaseDesktop2 = "sudo nixos-rebuild switch --show-trace --flake '/home/yh/workspace/nixos-config#baseDesktop' --option substituters https://mirrors.cernet.edu.cn/nix-channels/store";
proxySet = "export http_proxy=http://127.0.0.1:2334&&export https_proxy=http://127.0.0.1:2334";
proxyUnSet = "unset http_proxy&&unset https_proxy";
scpToX240 = "scp -r /home/yh/workspace/nixos-config/* yh@x240:/home/yh/workspace/nixos-config/";
#nix-store --optimise
myclean1 = "sudo nix-env --profile /nix/var/nix/profiles/system --list-generations \
sudo nix-env --profile /nix/var/nix/profiles/system --delete-generations +1 \
sudo nix-env --profile /nix/var/nix/profiles/per-user/root/channels --delete-generations +1 \
sudo nix-env --profile /nix/var/nix/profiles/per-user/yh/channels --delete-generations +1 \
sudo nix-env --profile /nix/var/nix/profiles/per-user/yh/profile --delete-generations +1 \
sudo nix-env --profile /nix/var/nix/profiles/per-user/yh/home-manager --delete-generations +1 \
nix-collect-garbage
echo 'is need to run: nix-collect-garbage -d or nix-store --gc --print-roots or nix-store --optimise'
";
# # for waybar restart
waybarRestart = "pkill waybar & sleep 0.5 && waybar";
};
initExtra = ''
#ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=#ff00ff,bg=cyan,bold,underline"
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=8'
ZSH_AUTOSUGGEST_STRATEGY=(history completion)
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=20
setopt extendedglob
setopt globstarshort
setopt autopushd # make cd keep a dir stack
# 启用大小写自动修正
setopt correct
compinit
# 设置补全系统对大小写不敏感
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
# 彩色 ls
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
fi
# 允许 ctrl 左右按照单词移动光标
bindkey '^[[1;5C' forward-word # Ctrl+ right
bindkey '^[[1;5D' backward-word # Ctrl+left
# ctrl a e 跳转
bindkey "^A" beginning-of-line
bindkey "^E" end-of-line
# 提示符格式
export PROMPT="%F{green}%n@%F{90}%m> %F{96}%B%F{green}%~
%(?.%F{green}>.%F{red} ?%? >)%f%F{46}%f%b "
# 一些需要单独配置等
# for golang
# export GOPROXY=https://goproxy.cn,direct
# for flutter and edge
export PUB_HOSTED_URL="https://pub.flutter-io.cn"
export FLUTTER_STORAGE_BASE_URL="https://storage.flutter-io.cn"
# for rust
export RUSTUP_DIST_SERVER="https://rsproxy.cn"
export RUSTUP_UPDATE_ROOT="https://rsproxy.cn/rustup"
'';
envExtra = ''
# set colors for exa, see https://github.com/ogham/exa/blob/master/man/exa_colors.5.md
export EXA_COLORS="di=33;1:su=1;4:sf=1:4"
'';
#oh-my-zsh = {
# enable = true;
# plugins = [ "git" "autosuggestions" "syntax-highlighting" ];
# theme = "dst";
#};
};
}
|