chore: 清除 zsh 残留,声明式 git 身份与 SSH config
- 移除所有 zsh 引用,补全 fish 迁移 - git.nix: 声明 userName/userEmail,删除 credential.helper store 和内网 sslVerify - 新增 programs.ssh 声明式配置(id_ed25519, addKeysToAgent) - 简化 install.sh 为 darwin/nixos 双平台
This commit is contained in:
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"recommendations": ["jnoortheen.nix-ide"]
|
||||
}
|
||||
+9
-16
@@ -3,10 +3,8 @@
|
||||
{
|
||||
programs.git = {
|
||||
enable = true;
|
||||
|
||||
# user.name / user.email: set per-user via git config or ~/.zshrc.local
|
||||
# git config --global user.name "Your Name"
|
||||
# git config --global user.email "your@email.com"
|
||||
userName = "imbytecat";
|
||||
userEmail = "imbytecat@gmail.com";
|
||||
|
||||
delta = {
|
||||
enable = true;
|
||||
@@ -14,15 +12,10 @@
|
||||
navigate = true;
|
||||
side-by-side = true;
|
||||
line-numbers = true;
|
||||
hyperlinks = true;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfig = {
|
||||
# Internal Git server (skip SSL verification)
|
||||
http."https://202.127.0.42:32443".sslVerify = false;
|
||||
|
||||
credential.helper = "store";
|
||||
merge.conflictstyle = "zdiff3";
|
||||
pull.rebase = true;
|
||||
push.autoSetupRemote = true;
|
||||
@@ -33,7 +26,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
# ── Lazygit ──────────────────────────────────────────
|
||||
programs.lazygit = {
|
||||
enable = true;
|
||||
settings = {
|
||||
@@ -41,19 +33,20 @@
|
||||
nerdFontsVersion = "3";
|
||||
showBottomLine = false;
|
||||
};
|
||||
git.paging = {
|
||||
pager = "delta --paging=never";
|
||||
};
|
||||
git.paging.pager = "delta --paging=never";
|
||||
update.method = "never";
|
||||
disableStartupPopups = true;
|
||||
};
|
||||
};
|
||||
|
||||
# ── GitHub CLI ───────────────────────────────────────
|
||||
programs.gh = {
|
||||
enable = true;
|
||||
settings = {
|
||||
git_protocol = "ssh";
|
||||
settings.git_protocol = "ssh";
|
||||
};
|
||||
|
||||
programs.ssh = {
|
||||
enable = true;
|
||||
addKeysToAgent = "yes";
|
||||
matchBlocks."*".identityFile = "~/.ssh/id_ed25519";
|
||||
};
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
{ pkgs, lib, ... }:
|
||||
{ ... }:
|
||||
|
||||
{
|
||||
programs.fish = {
|
||||
@@ -38,7 +38,7 @@
|
||||
# mise
|
||||
mise activate fish | source
|
||||
|
||||
# Sudo: double Escape to prepend sudo (like zsh sudo plugin)
|
||||
# Sudo: double Escape to prepend sudo
|
||||
bind \e\e 'fish_commandline_prepend sudo'
|
||||
|
||||
# Platform-specific rebuild command
|
||||
|
||||
+1
-2
@@ -4,7 +4,6 @@
|
||||
catppuccin = {
|
||||
enable = true;
|
||||
flavor = "mocha";
|
||||
# Automatically themes all supported programs that are enabled:
|
||||
# bat, btop, delta, fzf, lazygit, starship, tmux, zsh-syntax-highlighting, etc.
|
||||
# Automatically themes: bat, btop, delta, fish, fzf, lazygit, starship, tmux, etc.
|
||||
};
|
||||
}
|
||||
|
||||
+8
-36
@@ -1,51 +1,23 @@
|
||||
#!/bin/bash
|
||||
# NixOS / standalone Home Manager 安装脚本
|
||||
set -euo pipefail
|
||||
|
||||
REPO_URL="https://git.furtherverse.com/imbytecat/nix-config.git"
|
||||
CONFIG_DIR="$HOME/.config/nix-config"
|
||||
FLAKE_TARGET="${1:-wsl}" # wsl (default), bare, or home
|
||||
|
||||
echo "📥 获取配置仓库..."
|
||||
if [[ -d "$CONFIG_DIR/.git" ]]; then
|
||||
echo "⏩ 仓库已存在,拉取最新..."
|
||||
git -C "$CONFIG_DIR" pull
|
||||
else
|
||||
git clone "$REPO_URL" "$CONFIG_DIR"
|
||||
fi
|
||||
|
||||
echo "⚙️ 应用配置(目标: $FLAKE_TARGET)..."
|
||||
|
||||
case "$FLAKE_TARGET" in
|
||||
wsl|bare)
|
||||
sudo nixos-rebuild switch --flake "$CONFIG_DIR#$FLAKE_TARGET"
|
||||
echo ""
|
||||
echo "🎉 安装完成!请重新登录以使用 zsh。"
|
||||
echo ""
|
||||
echo "后续更新:"
|
||||
echo " cd $CONFIG_DIR && git pull && sudo nixos-rebuild switch --flake .#$FLAKE_TARGET"
|
||||
case "$(uname)" in
|
||||
Darwin)
|
||||
TARGET="${1:?Usage: $0 <mac-mini|macbook-air>}"
|
||||
darwin-rebuild switch --flake "$CONFIG_DIR#$TARGET"
|
||||
;;
|
||||
home)
|
||||
# Standalone home-manager(非 NixOS 系统:Ubuntu、Fedora、macOS 等)
|
||||
HM_USER="$(whoami)"
|
||||
if ! command -v home-manager &>/dev/null; then
|
||||
echo "📦 首次运行 home-manager..."
|
||||
nix run home-manager/master -- switch --flake "$CONFIG_DIR#$HM_USER"
|
||||
else
|
||||
home-manager switch --flake "$CONFIG_DIR#$HM_USER"
|
||||
fi
|
||||
echo ""
|
||||
echo "🎉 Home Manager 配置已应用!"
|
||||
echo ""
|
||||
echo "后续更新:"
|
||||
echo " cd $CONFIG_DIR && git pull && home-manager switch --flake .#$HM_USER"
|
||||
;;
|
||||
*)
|
||||
echo "❌ 未知目标: $FLAKE_TARGET"
|
||||
echo "用法: $0 [wsl|bare|home]"
|
||||
echo " wsl — NixOS on WSL (默认)"
|
||||
echo " bare — NixOS 裸机"
|
||||
echo " home — 独立 Home Manager (非 NixOS)"
|
||||
exit 1
|
||||
Linux)
|
||||
sudo nixos-rebuild switch --flake "$CONFIG_DIR#wsl"
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "Done! Restart your shell."
|
||||
|
||||
Reference in New Issue
Block a user