Co-Pilot / 辅助式
更新于 a month ago

dotfiles

Cconnorads
0.0k
connorads/dotfiles
76
Agent 评分

💡 摘要

该项目使用git管理dotfiles,无需使用符号链接,利用nix-darwin或home-manager进行配置。

🎯 适合人群

使用macOS或Linux的开发者管理配置的系统管理员开源爱好者寻找高效dotfile管理的用户希望简化设置的技术精英

🤖 AI 吐槽:看起来很能打,但别让配置把人劝退。

安全分析中风险

风险:Medium。建议检查:是否执行 shell/命令行指令;是否发起外网请求(SSRF/数据外发);文件读写范围与路径穿越风险。以最小权限运行,并在生产环境启用前审计代码与依赖。

dotfiles

Use git (and Sublime Merge) to manage dotfiles without using symlinks. Uses nix-darwin (macOS) or home-manager (Linux) and brew (macOS) to setup and install software, and mise to manage runtimes.

Usage

If you've already got your dotfiles setup you can use the following commands to manage your dotfiles.

Updating dotfiles

Track file

dotfiles add -f .somefile

Untrack file

dotfiles rm --cached .somefile

Managing system

macOS (nix-darwin)

Build and activate nix-darwin config. This will make changes to the system and update packages as per flake.nix

darwin-rebuild switch --flake ~/.config/nix # alias: drs

Update nix packages. This will update your non-homebrew packages and update flake.lock

nix flake update --flake ~/.config/nix # alias: nfu # You need to run build and activate after i.e. drs

Update brew packages

brew upgrade

Update mise packages

mise upgrade

Linux (home-manager)

Build and activate home-manager config. This will update packages as per flake.nix

home-manager switch --flake ~/.config/nix # alias: hms

Update nix packages. This will update your packages and update flake.lock

nix flake update --flake ~/.config/nix # alias: nfu # You need to run home-manager switch after i.e. hms

Update mise packages

mise upgrade

Setup

Setup (from this repo)

If you want to (fork and) clone this repo and use it for your own dotfiles, follow these steps.

  1. Clone repo

    DOTFILES_REPO=https://github.com/connorads/dotfiles/ DOTFILES_DIR=$HOME/git/dotfiles git clone --bare $DOTFILES_REPO $DOTFILES_DIR
  2. Change worktree to home directory

    cd $DOTFILES_DIR git config --unset core.bare git config core.worktree $HOME
  3. Put dotfiles from git into home directory (⚠️ this will overwrite existing dotfiles in home directory)

    cd $HOME git --git-dir=$DOTFILES_DIR/ checkout -f
  4. Setup nix, brew and install software (⚠️ skip the option to install Determinate Nix)

    macOS (nix-darwin):

    # Install Homebrew /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" eval "$(/opt/homebrew/bin/brew shellenv)" # Install Nix curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install . /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh # Build and activate nix-darwin configuration nix run nix-darwin/master#darwin-rebuild -- switch --flake ~/.config/nix

    Linux (home-manager):

    # Install Nix curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix | sh -s -- install . ~/.nix-profile/etc/profile.d/nix.sh # Build and activate home-manager configuration nix run home-manager/master -- switch --flake ~/.config/nix
  5. You can now reload your shell and open Sublime Merge

    smerge $DOTFILES_DIR

Setup YubiKey for sudo

macOS let's you use Touch ID for sudo but dem keyboards be expensive. Maybe you gots a YubiKey, this is how you set it up so you can touch your YubiKey instead of typing your password. The sudo/pam config is taken care of in flake.nix.

mkdir ~/.config/Yubico pamu2fcfg > ~/.config/Yubico/u2f_keys

Add a second key if you like

pamu2fcfg -n >> ~/.config/Yubico/u2f_keys

Setup (from scratch)

Follow these steps to recreate the setup for this repo from scratch.

  1. Create repository to store dotfiles

    DOTFILES_DIR=$HOME/git/dotfiles git init --bare $DOTFILES_DIR
  2. Change worktree to home directory

    cd $DOTFILES_DIR git config --unset core.bare git config core.worktree $HOME
  3. Ignore all files except .gitignore (Sublime merge doesn't support status.showUntrackedFiles=no)

    cd $HOME echo "/*" >> .gitignore echo "!.gitignore" >> .gitignore
  4. Add alias to .zshrc

    echo "alias dotfiles='git --git-dir=$HOME/git/dotfiles/'" >> $HOME/.zshrc
  5. You can now start tracking files

Credit

Inspired by

五维分析
清晰度8/10
创新性6/10
实用性9/10
完整性8/10
可维护性7/10
优缺点分析

优点

  • 高效管理dotfiles
  • 无需符号链接
  • 与nix-darwin和home-manager集成
  • 支持macOS和Linux

缺点

  • 可能需要熟悉git和命令行
  • 可能会覆盖现有的dotfiles
  • 仅限于特定的操作系统配置
  • 对于初学者来说,设置可能比较复杂

相关技能

pytorch

S
toolCode Lib / 代码库
92/ 100

“它是深度学习的瑞士军刀,但祝你好运能从47种安装方法里找到那个不会搞崩你系统的那一个。”

agno

S
toolCode Lib / 代码库
90/ 100

“它承诺成为智能体领域的Kubernetes,但得看开发者有没有耐心学习又一个编排层。”

nuxt-skills

S
toolCo-Pilot / 辅助式
90/ 100

“这本质上是一份组织良好的小抄,能把你的 AI 助手变成一只 Nuxt 框架的复读机。”

免责声明:本内容来源于 GitHub 开源项目,仅供展示和评分分析使用。

版权归原作者所有 connorads.