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"]
|
||||||
|
}
|
||||||
+10
-17
@@ -3,10 +3,8 @@
|
|||||||
{
|
{
|
||||||
programs.git = {
|
programs.git = {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
userName = "imbytecat";
|
||||||
# user.name / user.email: set per-user via git config or ~/.zshrc.local
|
userEmail = "imbytecat@gmail.com";
|
||||||
# git config --global user.name "Your Name"
|
|
||||||
# git config --global user.email "your@email.com"
|
|
||||||
|
|
||||||
delta = {
|
delta = {
|
||||||
enable = true;
|
enable = true;
|
||||||
@@ -14,15 +12,10 @@
|
|||||||
navigate = true;
|
navigate = true;
|
||||||
side-by-side = true;
|
side-by-side = true;
|
||||||
line-numbers = true;
|
line-numbers = true;
|
||||||
hyperlinks = true;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
extraConfig = {
|
extraConfig = {
|
||||||
# Internal Git server (skip SSL verification)
|
|
||||||
http."https://202.127.0.42:32443".sslVerify = false;
|
|
||||||
|
|
||||||
credential.helper = "store";
|
|
||||||
merge.conflictstyle = "zdiff3";
|
merge.conflictstyle = "zdiff3";
|
||||||
pull.rebase = true;
|
pull.rebase = true;
|
||||||
push.autoSetupRemote = true;
|
push.autoSetupRemote = true;
|
||||||
@@ -33,7 +26,6 @@
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# ── Lazygit ──────────────────────────────────────────
|
|
||||||
programs.lazygit = {
|
programs.lazygit = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings = {
|
||||||
@@ -41,19 +33,20 @@
|
|||||||
nerdFontsVersion = "3";
|
nerdFontsVersion = "3";
|
||||||
showBottomLine = false;
|
showBottomLine = false;
|
||||||
};
|
};
|
||||||
git.paging = {
|
git.paging.pager = "delta --paging=never";
|
||||||
pager = "delta --paging=never";
|
|
||||||
};
|
|
||||||
update.method = "never";
|
update.method = "never";
|
||||||
disableStartupPopups = true;
|
disableStartupPopups = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# ── GitHub CLI ───────────────────────────────────────
|
|
||||||
programs.gh = {
|
programs.gh = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
settings.git_protocol = "ssh";
|
||||||
git_protocol = "ssh";
|
};
|
||||||
};
|
|
||||||
|
programs.ssh = {
|
||||||
|
enable = true;
|
||||||
|
addKeysToAgent = "yes";
|
||||||
|
matchBlocks."*".identityFile = "~/.ssh/id_ed25519";
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -1,4 +1,4 @@
|
|||||||
{ pkgs, lib, ... }:
|
{ ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
programs.fish = {
|
programs.fish = {
|
||||||
@@ -38,7 +38,7 @@
|
|||||||
# mise
|
# mise
|
||||||
mise activate fish | source
|
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'
|
bind \e\e 'fish_commandline_prepend sudo'
|
||||||
|
|
||||||
# Platform-specific rebuild command
|
# Platform-specific rebuild command
|
||||||
|
|||||||
+1
-2
@@ -4,7 +4,6 @@
|
|||||||
catppuccin = {
|
catppuccin = {
|
||||||
enable = true;
|
enable = true;
|
||||||
flavor = "mocha";
|
flavor = "mocha";
|
||||||
# Automatically themes all supported programs that are enabled:
|
# Automatically themes: bat, btop, delta, fish, fzf, lazygit, starship, tmux, etc.
|
||||||
# bat, btop, delta, fzf, lazygit, starship, tmux, zsh-syntax-highlighting, etc.
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+8
-36
@@ -1,51 +1,23 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# NixOS / standalone Home Manager 安装脚本
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
REPO_URL="https://git.furtherverse.com/imbytecat/nix-config.git"
|
REPO_URL="https://git.furtherverse.com/imbytecat/nix-config.git"
|
||||||
CONFIG_DIR="$HOME/.config/nix-config"
|
CONFIG_DIR="$HOME/.config/nix-config"
|
||||||
FLAKE_TARGET="${1:-wsl}" # wsl (default), bare, or home
|
|
||||||
|
|
||||||
echo "📥 获取配置仓库..."
|
|
||||||
if [[ -d "$CONFIG_DIR/.git" ]]; then
|
if [[ -d "$CONFIG_DIR/.git" ]]; then
|
||||||
echo "⏩ 仓库已存在,拉取最新..."
|
|
||||||
git -C "$CONFIG_DIR" pull
|
git -C "$CONFIG_DIR" pull
|
||||||
else
|
else
|
||||||
git clone "$REPO_URL" "$CONFIG_DIR"
|
git clone "$REPO_URL" "$CONFIG_DIR"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "⚙️ 应用配置(目标: $FLAKE_TARGET)..."
|
case "$(uname)" in
|
||||||
|
Darwin)
|
||||||
case "$FLAKE_TARGET" in
|
TARGET="${1:?Usage: $0 <mac-mini|macbook-air>}"
|
||||||
wsl|bare)
|
darwin-rebuild switch --flake "$CONFIG_DIR#$TARGET"
|
||||||
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"
|
|
||||||
;;
|
;;
|
||||||
home)
|
Linux)
|
||||||
# Standalone home-manager(非 NixOS 系统:Ubuntu、Fedora、macOS 等)
|
sudo nixos-rebuild switch --flake "$CONFIG_DIR#wsl"
|
||||||
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
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
echo "Done! Restart your shell."
|
||||||
|
|||||||
Reference in New Issue
Block a user