style: 将项目中所有英文注释统一改为中文

This commit is contained in:
2026-04-15 16:40:20 +08:00
parent 2cd41bcd16
commit 41913d9a24
13 changed files with 68 additions and 65 deletions
+3 -3
View File
@@ -37,7 +37,7 @@
mylib = import ./lib { inherit inputs; }; mylib = import ./lib { inherit inputs; };
in in
{ {
# ── macOS hosts ───────────────────────────────────── # ── macOS 主机 ──────────────────────────────────────
darwinConfigurations = { darwinConfigurations = {
mac-mini = mylib.mkDarwin { mac-mini = mylib.mkDarwin {
hostname = "awesome-mac-mini"; hostname = "awesome-mac-mini";
@@ -54,7 +54,7 @@
}; };
}; };
# ── NixOS hosts (WSL on Windows PC) ───────────────── # ── NixOS 主机(Windows PC 上的 WSL──────────────
nixosConfigurations = { nixosConfigurations = {
wsl = mylib.mkNixos { wsl = mylib.mkNixos {
hostname = "awesome-wsl"; hostname = "awesome-wsl";
@@ -67,7 +67,7 @@
}; };
}; };
# ── Packages ──────────────────────────────────────── # ── 自定义包 ─────────────────────────────────────────
packages = nixpkgs.lib.genAttrs [ "aarch64-darwin" "x86_64-linux" ] ( packages = nixpkgs.lib.genAttrs [ "aarch64-darwin" "x86_64-linux" ] (
system: system:
let let
+9 -9
View File
@@ -24,7 +24,7 @@
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [
# Modern CLI replacements # 现代 CLI 替代工具
dust # du dust # du
duf # df duf # df
procs # ps procs # ps
@@ -33,25 +33,25 @@
yq # YAML yq # YAML
wget wget
# System info # 系统信息
fastfetch fastfetch
tealdeer # tldr tealdeer # tldr
# File management # 文件管理
gomi gomi
ouch # compression/decompression ouch # 压缩/解压
# Nix tools # Nix 工具
nix-output-monitor # nom nix-output-monitor # nom
nvd # nix version diff nvd # Nix 版本对比
nh # nix helper nh # Nix 辅助工具
just just
# AI coding agent # AI 编程代理
opencode opencode
comment-checker comment-checker
# Misc # 其他
ffmpeg ffmpeg
pandoc pandoc
]; ];
+5 -5
View File
@@ -2,16 +2,16 @@
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
# ── Language runtimes ── # ── 语言运行时 ──
nodejs nodejs
go go
bun bun
python3 python3
# ── Package management / version management ── # ── 包管理 / 版本管理 ──
uv uv
# ── LSP servers ── # ── LSP 服务器 ──
bash-language-server bash-language-server
gopls gopls
typescript-language-server typescript-language-server
@@ -22,7 +22,7 @@
nixd nixd
just-lsp just-lsp
# ── Linter / Formatter ── # ── 代码检查 / 格式化 ──
biome biome
ruff ruff
shellcheck shellcheck
@@ -31,7 +31,7 @@
statix statix
stylua stylua
# ── Code intelligence ── # ── 代码智能 ──
ast-grep ast-grep
]; ];
+2 -2
View File
@@ -1,7 +1,7 @@
_: _:
{ {
# Disable catppuccin/nix neovim integration — LazyVim manages its own colorscheme # 禁用 catppuccin/nix 的 Neovim 集成 — LazyVim 自行管理配色方案
catppuccin.nvim.enable = false; catppuccin.nvim.enable = false;
programs.neovim = { programs.neovim = {
@@ -22,7 +22,7 @@ _:
lang.docker.enable = true; lang.docker.enable = true;
}; };
# Catppuccin Mocha colorscheme (managed by LazyVim, not catppuccin/nix) # Catppuccin Mocha 配色方案(由 LazyVim 管理,非 catppuccin/nix
plugins = { plugins = {
colorscheme = '' colorscheme = ''
return { return {
+14 -14
View File
@@ -5,9 +5,9 @@ let
envCache = "${config.xdg.cacheHome}/op-env/env.fish"; envCache = "${config.xdg.cacheHome}/op-env/env.fish";
in in
{ {
# ── 1Password env template ────────────────────────── # ── 1Password 环境变量模板 ─────────────────────────────
# op:// references only — no real secrets, safe to commit # 仅包含 op:// 引用 — 无真实密钥,可安全提交
# Kept outside ~/.config/op — that dir must be 700 and owned by op CLI # 放在 ~/.config/op 之外 — 该目录必须是 700 权限且属于 op CLI
xdg.configFile."op-env/env.tpl".text = '' xdg.configFile."op-env/env.tpl".text = ''
set -gx AI_GATEWAY_BASE_URL "{{ op://Developer/AI Gateway API/URL }}" set -gx AI_GATEWAY_BASE_URL "{{ op://Developer/AI Gateway API/URL }}"
set -gx AI_GATEWAY_API_KEY "{{ op://Developer/AI Gateway API/credential }}" set -gx AI_GATEWAY_API_KEY "{{ op://Developer/AI Gateway API/credential }}"
@@ -19,13 +19,13 @@ in
enable = true; enable = true;
shellAbbrs = { shellAbbrs = {
# Navigation (one-shot, no need to recall in history) # 导航(一次性命令,无需记录历史)
".." = "cd .."; ".." = "cd ..";
"..." = "cd ../.."; "..." = "cd ../..";
}; };
shellAliases = { shellAliases = {
# File listing (eza) — base aliases (ls/la/lt) from programs.eza # 文件列表(eza)— 基础别名(ls/la/lt)来自 programs.eza
ll = "eza -lh"; ll = "eza -lh";
lla = "eza -lah --time-style=long-iso"; lla = "eza -lah --time-style=long-iso";
@@ -38,25 +38,25 @@ in
set -g fish_greeting set -g fish_greeting
fish_add_path $HOME/go/bin $HOME/.bun/bin fish_add_path $HOME/go/bin $HOME/.bun/bin
# Sudo: double Escape to prepend sudo # Escape sudo
bind \e\e 'fish_commandline_prepend sudo' bind \e\e 'fish_commandline_prepend sudo'
# WSL clipboard # WSL
if set -q WSL_DISTRO_NAME if set -q WSL_DISTRO_NAME
alias pbcopy clip.exe alias pbcopy clip.exe
alias pbpaste "powershell.exe -noprofile -c Get-Clipboard" alias pbpaste "powershell.exe -noprofile -c Get-Clipboard"
end end
# Windows Terminal: emit OSC 9;9 so new tab/pane opens in same directory # Windows Terminal OSC 9;9 使/
function __wt_osc9_9 --on-variable PWD function __wt_osc9_9 --on-variable PWD
if test -n "$WT_SESSION" if test -n "$WT_SESSION"
printf "\e]9;9;%s\e\\" (wslpath -w "$PWD") printf "\e]9;9;%s\e\\" (wslpath -w "$PWD")
end end
end end
# 1Password env vars (cached locally, no network on shell start) # 1Password
# Startup only sources the cache; run op-env-refresh manually to fetch/update. # op-env-refresh /
# Auth via OP_SERVICE_ACCOUNT_TOKEN (set it in ~/.config/fish/local.fish) # OP_SERVICE_ACCOUNT_TOKEN ~/.config/fish/local.fish
function op-env-refresh --description "Fetch secrets from 1Password and cache locally" function op-env-refresh --description "Fetch secrets from 1Password and cache locally"
if not type -q op if not type -q op
echo "op-env: op CLI not found in PATH" >&2 echo "op-env: op CLI not found in PATH" >&2
@@ -85,7 +85,7 @@ in
echo "op-env: inject failed; old cache kept" >&2 echo "op-env: inject failed; old cache kept" >&2
return 1 return 1
end end
# Capture old var names before replacing cache #
set -l old_vars set -l old_vars
if test -f "${envCache}" if test -f "${envCache}"
set old_vars (string match -rg 'set -gx (\S+)' < "${envCache}") set old_vars (string match -rg 'set -gx (\S+)' < "${envCache}")
@@ -115,12 +115,12 @@ in
echo "op-env: cleared" echo "op-env: cleared"
end end
# Source cached secrets (instant, no network) #
if test -f "${envCache}" if test -f "${envCache}"
source "${envCache}" source "${envCache}"
end end
# User-local config (OP_SERVICE_ACCOUNT_TOKEN, per-machine overrides) # OP_SERVICE_ACCOUNT_TOKEN
if test -f ~/.config/fish/local.fish if test -f ~/.config/fish/local.fish
source ~/.config/fish/local.fish source ~/.config/fish/local.fish
end end
+1 -1
View File
@@ -3,7 +3,7 @@
{ {
programs.ghostty = { programs.ghostty = {
enable = pkgs.stdenv.isDarwin; enable = pkgs.stdenv.isDarwin;
package = null; # installed via Homebrew cask package = null; # 通过 Homebrew cask 安装
settings = { settings = {
font-family = "Maple Mono NF CN"; font-family = "Maple Mono NF CN";
font-size = 14; font-size = 14;
+8 -8
View File
@@ -19,7 +19,7 @@
]; ];
}; };
# ── Atuin (shell history) ──────────────────────────── # ── AtuinShell 历史记录)─────────────────────────────
programs.atuin = { programs.atuin = {
enable = true; enable = true;
enableFishIntegration = true; enableFishIntegration = true;
@@ -33,11 +33,11 @@
}; };
}; };
# ── Zoxide (smart cd) ─────────────────────────────── # ── Zoxide(智能 cd)──────────────────────────────────
programs.zoxide = { programs.zoxide = {
enable = true; enable = true;
enableFishIntegration = true; enableFishIntegration = true;
options = [ "--cmd cd" ]; # cd/cdi instead of z/zi options = [ "--cmd cd" ]; # cd/cdi 替代 z/zi
}; };
# ── Direnv + nix-direnv ───────────────────────────── # ── Direnv + nix-direnv ─────────────────────────────
@@ -50,7 +50,7 @@
}; };
}; };
# ── Bat (cat replacement) ─────────────────────────── # ── Batcat 替代)────────────────────────────────────
programs.bat = { programs.bat = {
enable = true; enable = true;
extraPackages = with pkgs.bat-extras; [ extraPackages = with pkgs.bat-extras; [
@@ -59,7 +59,7 @@
]; ];
}; };
# ── Eza (ls replacement) ──────────────────────────── # ── Ezals 替代)─────────────────────────────────────
programs.eza = { programs.eza = {
enable = true; enable = true;
enableFishIntegration = true; enableFishIntegration = true;
@@ -70,14 +70,14 @@
]; ];
}; };
# ── Yazi (file manager) ───────────────────────────── # ── Yazi(文件管理器)────────────────────────────────
programs.yazi = { programs.yazi = {
enable = true; enable = true;
enableFishIntegration = true; enableFishIntegration = true;
shellWrapperName = "y"; shellWrapperName = "y";
}; };
# ── Btop (system monitor) ─────────────────────────── # ── Btop(系统监控)──────────────────────────────────
programs.btop = { programs.btop = {
enable = true; enable = true;
settings = { settings = {
@@ -85,7 +85,7 @@
}; };
}; };
# ── Zellij (terminal multiplexer) ──────────────────── # ── Zellij(终端复用器)──────────────────────────────
programs.zellij = { programs.zellij = {
enable = true; enable = true;
enableFishIntegration = false; enableFishIntegration = false;
+7 -7
View File
@@ -1,13 +1,13 @@
{ ... }: { ... }:
{ {
# ── Mac Mini specific ───────────────────────────────── # ── Mac Mini 专属配置 ────────────────────────────────
# Always plugged in — 24/7 server role # 常驻供电 — 全天候服务器角色
# Touch ID for sudo # Touch ID 验证 sudo
security.pam.services.sudo_local.touchIdAuth = true; security.pam.services.sudo_local.touchIdAuth = true;
# ── Never sleep ───────────────────────────────────── # ── 禁止睡眠 ────────────────────────────────────────
power.sleep.computer = "never"; power.sleep.computer = "never";
power.sleep.display = "never"; power.sleep.display = "never";
power.sleep.harddisk = "never"; power.sleep.harddisk = "never";
@@ -15,15 +15,15 @@
power.restartAfterPowerFailure = true; power.restartAfterPowerFailure = true;
power.restartAfterFreeze = true; power.restartAfterFreeze = true;
# ── Wake on LAN ────────────────────────────────── # ── 网络唤醒(WoL─────────────────────────────────
networking.wakeOnLan.enable = true; networking.wakeOnLan.enable = true;
# ── Screen Sharing (VNC) & pmset ───────────────── # ── 屏幕共享(VNC& pmset ──────────────────────────
system.activationScripts.postActivation.text = '' system.activationScripts.postActivation.text = ''
# VNC # VNC
launchctl enable system/com.apple.screensharing launchctl enable system/com.apple.screensharing
launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist 2>/dev/null || true launchctl load -w /System/Library/LaunchDaemons/com.apple.screensharing.plist 2>/dev/null || true
# Disable Power Nap # Power Nap
pmset -a powernap 0 pmset -a powernap 0
''; '';
+5 -5
View File
@@ -1,15 +1,15 @@
{ ... }: { ... }:
{ {
# ── MacBook Air specific ────────────────────────────── # ── MacBook Air 专属配置 ─────────────────────────────
# Portable — battery-conscious settings # 便携设备 — 注意电池续航
# Touch ID for sudo # Touch ID 验证 sudo
security.pam.services.sudo_local.touchIdAuth = true; security.pam.services.sudo_local.touchIdAuth = true;
# ── Notch-specific ───────────────────────────────── # ── 刘海屏适配 ──────────────────────────────────────
homebrew.casks = [ homebrew.casks = [
"thaw" # menu bar manager for notched display "thaw" # 刘海屏菜单栏管理工具
]; ];
system.stateVersion = 5; system.stateVersion = 5;
+1 -1
View File
@@ -2,7 +2,7 @@
{ {
# ── Shell ───────────────────────────────────────────── # ── Shell ─────────────────────────────────────────────
# Remove NixOS default aliases (ls/ll/l) — managed by Home Manager eza # 移除 NixOS 默认别名(ls/ll/l)— 由 Home Manager eza 管理
environment.shellAliases = lib.mkForce { }; environment.shellAliases = lib.mkForce { };
# ── WSL ────────────────────────────────────────────── # ── WSL ──────────────────────────────────────────────
+3 -3
View File
@@ -7,7 +7,7 @@ let
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDRTOo48gzzRGT+bF9dzJCFJu61YgsQVONFtxU9kTPIg" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDRTOo48gzzRGT+bF9dzJCFJu61YgsQVONFtxU9kTPIg"
]; ];
# Shared home-manager configuration block # 共享的 Home Manager 配置块
homeManagerConfig = username: { homeManagerConfig = username: {
home-manager = { home-manager = {
useGlobalPkgs = true; useGlobalPkgs = true;
@@ -24,7 +24,7 @@ let
}; };
in in
{ {
# ── NixOS host builder ────────────────────────────── # ── NixOS 主机构建器 ─────────────────────────────────
mkNixos = mkNixos =
{ {
hostname, hostname,
@@ -53,7 +53,7 @@ in
++ extraModules; ++ extraModules;
}; };
# ── nix-darwin host builder ───────────────────────── # ── nix-darwin 主机构建器 ────────────────────────────
mkDarwin = mkDarwin =
{ {
hostname, hostname,
+9 -6
View File
@@ -8,7 +8,7 @@
{ {
system.primaryUser = username; system.primaryUser = username;
# ── Passwordless sudo ─────────────────────────────── # ── 免密 sudo ────────────────────────────────────────
security.sudo.extraConfig = '' security.sudo.extraConfig = ''
${username} ALL=(ALL) NOPASSWD:ALL ${username} ALL=(ALL) NOPASSWD:ALL
''; '';
@@ -21,7 +21,7 @@
openssh.authorizedKeys.keys = sshKeys; openssh.authorizedKeys.keys = sshKeys;
}; };
# ── macOS system preferences ─────────────────────── # ── macOS 系统偏好设置 ────────────────────────────────
system.defaults = { system.defaults = {
LaunchServices.LSQuarantine = false; LaunchServices.LSQuarantine = false;
dock = { dock = {
@@ -42,7 +42,7 @@
KeyRepeat = 2; KeyRepeat = 2;
}; };
CustomUserPreferences."ch.sudo.cyberduck" = { CustomUserPreferences."ch.sudo.cyberduck" = {
# Suppress donation prompt permanently (date far in the future) # 永久禁用捐赠提示(日期设为遥远的未来)
"donate.reminder.date" = 253402300799000; "donate.reminder.date" = 253402300799000;
}; };
}; };
@@ -50,7 +50,10 @@
# ── Homebrew ─────────────────────────────────────── # ── Homebrew ───────────────────────────────────────
homebrew = { homebrew = {
enable = true; enable = true;
greedyCasks = true; # always upgrade casks even if they auto-update greedyCasks = true; # 即使 cask 自动更新也始终升级
# 已废弃:Homebrew 将于 2026-09 后移除 --no-quarantine
# 待所有 cask 通过 Gatekeeper(签名且公证)后移除此项
caskArgs.no_quarantine = true;
taps = [ taps = [
"goooler/repo" "goooler/repo"
@@ -60,7 +63,7 @@
"mole" "mole"
]; ];
# GUI apps # GUI 应用
casks = [ casks = [
"1password" "1password"
"brave-browser" "brave-browser"
@@ -101,7 +104,7 @@
onActivation = { onActivation = {
autoUpdate = true; autoUpdate = true;
upgrade = true; upgrade = true;
cleanup = "zap"; # remove anything not declared above cleanup = "zap"; # 移除所有未声明的内容
}; };
}; };
} }
+1 -1
View File
@@ -11,7 +11,7 @@
warn-dirty = false; warn-dirty = false;
}; };
# Disable channels — we use flakes exclusively # 禁用 channels — 仅使用 flakes
nix.channel.enable = false; nix.channel.enable = false;
nixpkgs = { nixpkgs = {