refactor: 重构为三设备架构,zsh 迁移至 fish

- 新增 darwinConfigurations: mac-mini, macbook-air (aarch64-darwin)
- WSL 统一用户名为 imbytecat,主机名改为 awesome-* 系列
- zsh 全面迁移至 fish (abbrs, 内置补全/高亮, zoxide --cmd cd)
- 激活 nix-darwin 模块: Homebrew, 系统偏好, Touch ID sudo
- 移除 bare/standalone 配置及 catppuccin nixosModule from mkDarwin
This commit is contained in:
2026-04-10 21:48:19 +08:00
parent 25d9ca3756
commit 68184abd8f
14 changed files with 196 additions and 251 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
imports = [
./zsh.nix
./fish.nix
./starship.nix
./tools.nix
./tmux.nix
+63
View File
@@ -0,0 +1,63 @@
{ pkgs, lib, ... }:
{
programs.fish = {
enable = true;
shellAbbrs = {
# Navigation
".." = "cd ..";
"..." = "cd ../..";
# File listing (eza)
ls = "eza --icons --group-directories-first";
ll = "eza -la --icons --git --group-directories-first";
la = "eza -a --icons --group-directories-first";
lt = "eza --tree --level=2 --icons";
# Tools
cat = "bat --paging=never";
rm = "trash-put";
lg = "lazygit";
vi = "nvim";
# Network
http = "xh";
# Nix
update = "nix flake update --flake ~/.config/nix-config";
};
interactiveShellInit = ''
# No greeting
set -g fish_greeting
# PATH
fish_add_path $HOME/go/bin $HOME/.bun/bin
# mise
mise activate fish | source
# Sudo: double Escape to prepend sudo (like zsh sudo plugin)
bind \e\e 'fish_commandline_prepend sudo'
# Platform-specific rebuild command
if test (uname) = Darwin
abbr --add rebuild "darwin-rebuild switch --flake ~/.config/nix-config"
else
abbr --add rebuild "sudo nixos-rebuild switch --flake ~/.config/nix-config"
end
# WSL clipboard
if set -q WSL_DISTRO_NAME
alias pbcopy clip.exe
alias pbpaste "powershell.exe -noprofile -c Get-Clipboard"
end
# User-local overrides
if test -f ~/.config/fish/local.fish
source ~/.config/fish/local.fish
end
'';
};
}
+1 -1
View File
@@ -3,7 +3,7 @@
{
programs.starship = {
enable = true;
enableZshIntegration = true;
enableFishIntegration = true;
settings = {
add_newline = false;
+7 -6
View File
@@ -4,7 +4,7 @@
# ── FZF ──────────────────────────────────────────────
programs.fzf = {
enable = true;
enableZshIntegration = true;
enableFishIntegration = true;
defaultCommand = "fd --type f --hidden --follow --exclude .git";
defaultOptions = [
"--height=40%"
@@ -22,7 +22,7 @@
# ── Atuin (shell history) ────────────────────────────
programs.atuin = {
enable = true;
enableZshIntegration = true;
enableFishIntegration = true;
settings = {
enter_accept = true;
filter_mode = "host";
@@ -36,13 +36,14 @@
# ── Zoxide (smart cd) ───────────────────────────────
programs.zoxide = {
enable = true;
enableZshIntegration = true;
enableFishIntegration = true;
options = [ "--cmd cd" ]; # cd/cdi instead of z/zi
};
# ── Direnv + nix-direnv ─────────────────────────────
programs.direnv = {
enable = true;
enableZshIntegration = true;
enableFishIntegration = true;
nix-direnv.enable = true;
config.global = {
warn_timeout = "120s";
@@ -61,7 +62,7 @@
# ── Eza (ls replacement) ────────────────────────────
programs.eza = {
enable = true;
enableZshIntegration = false; # we use custom aliases in zsh.nix
enableFishIntegration = false; # we use custom abbrs in fish.nix
git = true;
icons = "auto";
extraOptions = [
@@ -73,7 +74,7 @@
# ── Yazi (file manager) ─────────────────────────────
programs.yazi = {
enable = true;
enableZshIntegration = true;
enableFishIntegration = true;
};
# ── Btop (system monitor) ───────────────────────────
-72
View File
@@ -1,72 +0,0 @@
{ pkgs, ... }:
{
programs.zsh = {
enable = true;
autocd = true;
oh-my-zsh = {
enable = true;
plugins = [
"git" # git aliases (gst, gco, gp...)
"sudo" # double ESC → prepend sudo
"extract" # x file.tar.gz → auto extract
"direnv" # direnv hook
];
};
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
shellAliases = {
# Navigation
cd = "z";
cdi = "zi";
".." = "cd ..";
"..." = "cd ../..";
# File listing (eza)
ls = "eza --icons --group-directories-first";
ll = "eza -la --icons --git --group-directories-first";
la = "eza -a --icons --group-directories-first";
lt = "eza --tree --level=2 --icons";
# Tools
cat = "bat --paging=never";
rm = "trash-put";
lg = "lazygit";
vi = "nvim";
# Network
http = "xh";
# Nix shortcuts
rebuild = "sudo nixos-rebuild switch --flake ~/.config/nix-config";
update = "nix flake update --flake ~/.config/nix-config";
};
initExtra = ''
# Shell options
setopt INTERACTIVE_COMMENTS
setopt NO_BEEP
# PATH (manual go/bun global tools)
export PATH="$HOME/go/bin:$HOME/.bun/bin:$PATH"
# fzf-tab plugin
source ${pkgs.zsh-fzf-tab}/share/fzf-tab/fzf-tab.plugin.zsh
# mise
eval "$(mise activate zsh)"
# WSL clipboard
if [[ -n "$WSL_DISTRO_NAME" ]]; then
alias pbcopy="clip.exe"
alias pbpaste="powershell.exe -noprofile -c Get-Clipboard"
fi
# User-local overrides
[[ -f ~/.zshrc.local ]] && source ~/.zshrc.local
'';
};
}