- Manage applications with Nix and Home Manager, Brewfile
- Manage multiple Git accounts with separate SSH keys and Git settings
- user settings (e.g. git global ignore) managed by Nix, symlinked to the home directory
git clone or Extract the zip file to get this repository on your local machine.
Run the installation script to set up Nix, Home Manager, and Git accounts.
./scripts/install.shIn the case of multiple Git accounts, scripts/install.sh will prompt you to register additional accounts.
If you use homebrew to manage additioanl applications, you can type this command to install additonal applications.
brew bundleIf you add or remove applecation, you can use
brew bundle dumpautomatically, or edit Brewfile on hand.
This installation script creates accounts.csv in the repository root to manage additional Git accounts. The script uses this file to set up the following:
~/Dev/{dir}/: Additional account's development directory~/.config/git/accounts.include: Git configuration that includes account-specific settings based on the current directory~/.config/git/accounts/{dir}.gitconfig: Account-specific Git settings~/.ssh/id_ed25519_{dir}: SSH keys for additional accountsi
If an existing accounts.csv file is present, the script will ask whether to use it as is or create a new one through interactive input.
If you edit accounts.csv by hand, follow accounts.csv.example format and make sure to run ./scripts/install.sh again to apply the changes.
You can use agc to clone repositories with the appropriate SSH key and Git settings based on the directory.
Usage: agc [<dir>] <url> [<path>]
dir: accounts.csv のディレクトリ名(例: work)。省略時はデフォルトアカウント
url: SSH URL(git@... または ssh://... のみ対応)
path: clone先(省略時は ~/Dev/<dir>/<repo名>、dir省略時は ~/Dev/<repo名>)
相対パスはカレントディレクトリ基準で解決後、
clone先ベース配下のみ許可。通常は省略を推奨。After clone ripository, you can use git commands as usual. The appropriate SSH key and Git settings will be applied based on the directory.
nixとhome-managerの設定は、リポジトリルートで次のコマンドを実行することで適用されます。
nix run home-manager -- switch --flake .#kokiclaude codeやcodex等のAIエージェントでは、nix-verify skillにより、フォーマットとビルドを含めた変更の適用を行うようにしています。
aliasなどのsymlinkで管理している設定は、ディレクトリの移動を伴わないものであれば、変更を加えるだけで次回のターミナル起動時に反映されます。
macOSのアップデートなど、特定のタイミングで、nixで管理するアプリケーションが使用できなくなることがあります。
その場合は、scripts/install.sh を再度実行してみてください。NixのインストールとHome Managerの設定が再度適用されます。
cat ~/.ssh/id_ed25519.pub
cat ~/.ssh/id_ed25519_<dir>.pubデフォルトアカウントの接続確認:
ssh -T git@github.com追加アカウントの SSH コマンド単体での確認:
ssh -i ~/.ssh/id_ed25519_<dir> -o IdentitiesOnly=yes -T git@github.comNote
ssh -T git@github.com はディレクトリに関係なく、常に SSH のデフォルト鍵で接続します。
追加アカウントの鍵切り替えは Git の includeIf gitdir と core.sshCommand で行うため、実際の切り替え確認は git push や git ls-remote など Git 経由で行ってください。