From 6863ca7d7dc0919f661a3a218cb092d63dd873ca Mon Sep 17 00:00:00 2001 From: imbytecat Date: Wed, 25 Mar 2026 13:01:51 +0800 Subject: [PATCH] Initial commit: dcli-based Arch Linux WSL configuration - Bootstrap script for yay and dcli installation - Declarative package management with modules (base, zsh, dev-tools) - China mirror configuration (Tsinghua) - Zsh with oh-my-zsh, autosuggestions, syntax-highlighting - Dev tools: mise, zoxide, fzf, ripgrep, fd, bat --- README.md | 31 ++++++++++++++++++++++++++++++ arch-config/config.yaml | 1 + arch-config/files/etc/pacman.conf | 18 +++++++++++++++++ arch-config/files/home/.zshrc | 16 +++++++++++++++ arch-config/hosts/wsl.yaml | 9 +++++++++ arch-config/modules/base.yaml | 7 +++++++ arch-config/modules/dev-tools.yaml | 9 +++++++++ arch-config/modules/zsh.yaml | 8 ++++++++ bootstrap.sh | 24 +++++++++++++++++++++++ 9 files changed, 123 insertions(+) create mode 100644 README.md create mode 100644 arch-config/config.yaml create mode 100644 arch-config/files/etc/pacman.conf create mode 100644 arch-config/files/home/.zshrc create mode 100644 arch-config/hosts/wsl.yaml create mode 100644 arch-config/modules/base.yaml create mode 100644 arch-config/modules/dev-tools.yaml create mode 100644 arch-config/modules/zsh.yaml create mode 100755 bootstrap.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..08797b9 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# Arch Linux WSL 初始化配置 + +使用 dcli 声明式管理 Arch Linux 配置。 + +## 快速开始 + +```bash +# 1. 克隆仓库 +git clone git@git-ssh.furtherverse.com:imbytecat/archlinux-wsl-init.git +cd archlinux-wsl-init + +# 2. 运行 bootstrap(仅首次) +chmod +x bootstrap.sh +./bootstrap.sh +``` + +## 配置说明 + +- `arch-config/hosts/wsl.yaml` - WSL 配置 +- `arch-config/modules/` - 模块化包管理 +- `arch-config/files/` - 配置文件(自动同步) + +## 更新配置 + +```bash +# 修改配置后同步 +dcli sync + +# 更新系统 +dcli update +``` diff --git a/arch-config/config.yaml b/arch-config/config.yaml new file mode 100644 index 0000000..b1a216a --- /dev/null +++ b/arch-config/config.yaml @@ -0,0 +1 @@ +active_host: wsl diff --git a/arch-config/files/etc/pacman.conf b/arch-config/files/etc/pacman.conf new file mode 100644 index 0000000..12e078f --- /dev/null +++ b/arch-config/files/etc/pacman.conf @@ -0,0 +1,18 @@ +[options] +HoldPkg = pacman glibc +Architecture = auto +Color +CheckSpace +ParallelDownloads = 5 + +SigLevel = Required DatabaseOptional +LocalFileSigLevel = Optional + +[core] +Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch + +[extra] +Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch + +[multilib] +Server = https://mirrors.tuna.tsinghua.edu.cn/archlinux/$repo/os/$arch diff --git a/arch-config/files/home/.zshrc b/arch-config/files/home/.zshrc new file mode 100644 index 0000000..c9393fd --- /dev/null +++ b/arch-config/files/home/.zshrc @@ -0,0 +1,16 @@ +# Oh My Zsh +export ZSH="$HOME/.oh-my-zsh" +ZSH_THEME="robbyrussell" +plugins=(git zsh-autosuggestions zsh-syntax-highlighting) +source $ZSH/oh-my-zsh.sh + +# mise +eval "$(mise activate zsh)" + +# zoxide +eval "$(zoxide init zsh)" + +# Aliases +alias ls='ls --color=auto' +alias ll='ls -lah' +alias cd='z' diff --git a/arch-config/hosts/wsl.yaml b/arch-config/hosts/wsl.yaml new file mode 100644 index 0000000..5cb1f6c --- /dev/null +++ b/arch-config/hosts/wsl.yaml @@ -0,0 +1,9 @@ +host: wsl +aur_helper: yay +modules: + - base + - zsh + - dev-tools +settings: + files_sync: true + auto_prune: true diff --git a/arch-config/modules/base.yaml b/arch-config/modules/base.yaml new file mode 100644 index 0000000..9737316 --- /dev/null +++ b/arch-config/modules/base.yaml @@ -0,0 +1,7 @@ +packages: + - base-devel + - git + - curl + - wget + - vim + - neovim diff --git a/arch-config/modules/dev-tools.yaml b/arch-config/modules/dev-tools.yaml new file mode 100644 index 0000000..9bd2d54 --- /dev/null +++ b/arch-config/modules/dev-tools.yaml @@ -0,0 +1,9 @@ +packages: + - fzf + - ripgrep + - fd + - bat + +aur_packages: + - mise + - zoxide diff --git a/arch-config/modules/zsh.yaml b/arch-config/modules/zsh.yaml new file mode 100644 index 0000000..b3ec139 --- /dev/null +++ b/arch-config/modules/zsh.yaml @@ -0,0 +1,8 @@ +packages: + - zsh + - zsh-completions + +aur_packages: + - oh-my-zsh-git + - zsh-autosuggestions + - zsh-syntax-highlighting diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100755 index 0000000..fab98e0 --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,24 @@ +#!/bin/bash +set -e + +echo "==> 安装 yay (唯一手动步骤)..." +if ! command -v yay &> /dev/null; then + sudo pacman -S --needed --noconfirm base-devel git + cd /tmp + git clone https://aur.archlinux.org/yay.git + cd yay + makepkg -si --noconfirm + cd ~ +fi + +echo "==> 安装 dcli..." +yay -S --needed --noconfirm dcli-arch-git + +echo "==> 初始化 dcli 配置..." +mkdir -p ~/.config/arch-config +cp -r ./arch-config/* ~/.config/arch-config/ + +echo "==> 运行 dcli sync..." +dcli sync + +echo "✓ 完成!所有配置已应用"