ITADN
ryoppippi/dotfiles
ryoppippi/dotfiles · 文件 下载 ZIP
文件最后提交记录最后更新时间
README.md
以下内容由 AI 翻译,如有问题请点此提交 issue 反馈

dotfiles

DeepWiki

Nix 配置

本仓库使用 Nix 及其模块化结构,以在 macOS 和 Linux 上管理系统配置和 dotfiles。

模块结构

配置被组织为模块化文件:

  • flake.nix - 包含输入/输出的主入口点
  • nix/home.nix - Home Manager 配置(跨平台)
    • 使用 home.file 的 Dotfiles 符号链接
    • 用户软件包列表
    • 通过 pkgs.stdenv.isDarwin 实现的特定平台软件包
  • nix/darwin.nix - macOS 系统配置 (nix-darwin)
    • 系统设置和用户配置
    • Homebrew 软件包 (taps, brews, casks, masApps)
  • nix/overlays.nix - AI 工具的软件包 overlays

初始设置

macOS

  1. 安装 Nix:

     curl -sSfL https://artifacts.nixos.org/nix-installer | sh -s -- install --enable-flakes
  2. 使用 ghq 获取此仓库:

    nix shell nixpkgs#ghq nixpkgs#git --command ghq get github.com/ryoppippi/dotfiles
    cd "$(nix shell nixpkgs#ghq --command ghq root)/github.com/ryoppippi/dotfiles"
  3. 打开 Mac App Store:

    open -a "App Store" # Sign in with your Apple Account before continuing.
  4. 应用 nix-darwin 配置(这将自动安装 Homebrew):

    sudo xcodebuild -license accept
    nix --accept-flake-config run .#switch
  5. 重新加载你的 shell:

    exec fish

GitHub API 速率限制

如果 Nix 报告了 GitHub API 速率限制,请从凭证助手或密码管理器中加载 GitHub 令牌到 GITHUB_TOKEN,然后使用经过身份验证的 GitHub 访问权限重试。请勿将令牌直接粘贴到命令中 或将其提交到此仓库。

NIX_CONFIG="access-tokens = github.com=$GITHUB_TOKEN" \
  nix --accept-flake-config run .#switch

Linux

  1. 安装 Nix(如果尚未安装):

    curl --proto '=https' --tlsv1.2 -sSf -L https://install.nixos.org | sh -s -- install
  2. 使用 ghq 获取此仓库:

    nix shell nixpkgs#ghq nixpkgs#git --command ghq get github.com/ryoppippi/dotfiles
    cd "$(nix shell nixpkgs#ghq --command ghq root)/github.com/ryoppippi/dotfiles"
  3. 应用 Home Manager 配置:

    nix run .#switch

日常使用

修改配置文件(flake.nixnix/home.nixnix/darwin.nix)后:

# Apply changes (macOS or Linux)
nix run .#switch

# Update dependencies (macOS only)
nix run .#update

# Test build without applying
nix run .#build

窗口管理

参见 OmniWM 配置与键盘工作流

可用的 Nix 应用

macOS

  • nix run .#switch - 构建并应用 darwin + Home Manager 配置
  • nix run .#update - 更新 flake.lock 依赖项
  • nix run .#update-ai-tools - 更新 llm-agents 输入
  • nix run .#build - 构建配置(试运行)

Linux

  • nix run .#switch - 构建并应用 Home Manager 配置
  • nix run .#build - 构建配置(试运行)

Dotfiles 管理

所有 dotfiles 均通过 Home Manager 的 home.file 进行管理,并链接到仓库:

  • nix run .#switch 时自动创建符号链接
  • Dotfiles 在仓库中保持可修改
  • 无需单独的 dotfiles CLI

由 Nix 管理

  • AI 开发工具: claude-code, codex, cursor-agent, opencode, copilot-cli, coderabbit-cli
  • 核心工具: git, neovim, fish, tmux, ripgrep, fd, fzf, bat, eza 等
  • 开发: Go, Node.js, Bun, Deno, 语言服务器
  • 系统配置 (macOS): sudo 使用 Touch ID, Homebrew 集成

统计

Alt