150 lines
3.6 KiB
Markdown
150 lines
3.6 KiB
Markdown
# Dev Environment Setup
|
|
|
|
Template for Part 1 of the setup script. All steps are idempotent.
|
|
|
|
## Homebrew PATH
|
|
|
|
```bash
|
|
if ! grep -q 'brew shellenv' ~/.zprofile 2>/dev/null; then
|
|
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
|
|
fi
|
|
eval "$(/opt/homebrew/bin/brew shellenv)"
|
|
```
|
|
|
|
## Packages
|
|
|
|
Install via brew (skip if present):
|
|
|
|
```bash
|
|
for pkg in neovim tmux git starship gh node; do
|
|
if brew list "$pkg" &>/dev/null; then
|
|
echo " $pkg: installed"
|
|
else
|
|
brew install "$pkg"
|
|
fi
|
|
done
|
|
```
|
|
|
|
Bun via official installer (not in Homebrew):
|
|
|
|
```bash
|
|
if [ -x ~/.bun/bin/bun ]; then
|
|
echo " bun: installed"
|
|
else
|
|
curl -fsSL https://bun.sh/install | bash
|
|
fi
|
|
```
|
|
|
|
## Git Identity
|
|
|
|
Set global git identity if not configured. Use env vars or defaults:
|
|
|
|
```bash
|
|
if [ -z "$(git config --global user.name)" ]; then
|
|
git config --global user.name "${GIT_USER_NAME:-$(whoami)}"
|
|
git config --global user.email "${GIT_USER_EMAIL:-$(whoami)@users.noreply.github.com}"
|
|
fi
|
|
```
|
|
|
|
For GitHub accounts, use the noreply email: `<username>@users.noreply.github.com`
|
|
|
|
## gh Authentication
|
|
|
|
After installing gh, the user must run `gh auth login` interactively
|
|
(browser or token flow). Then set up the git credential helper so
|
|
`git push` works over HTTPS without prompting:
|
|
|
|
```bash
|
|
gh auth setup-git
|
|
```
|
|
|
|
This is critical for headless servers where HTTPS git push would
|
|
otherwise fail with "could not read Username: Device not configured".
|
|
|
|
## Git Repos
|
|
|
|
Three repos should be initialized and pushed after setup:
|
|
|
|
- `~/.agents` — Signet agent identity (initialized by signet, not the script)
|
|
- `~/.<client>` — Server config and scripts (set via `CLIENT_DIR` env var)
|
|
- `~/.config/nvim` — Nvim config (cloned from source, may be re-pointed)
|
|
|
|
Each repo uses `upstream` as the remote name. The script attempts to
|
|
push all repos that have an upstream remote configured.
|
|
|
|
## Nvim Config
|
|
|
|
Clone nvim config (default: Nicholai's from Gitea, override with `NVIM_REPO`):
|
|
|
|
```bash
|
|
if [ -d ~/.config/nvim/.git ]; then
|
|
echo "already cloned"
|
|
else
|
|
mkdir -p ~/.config
|
|
git clone "$NVIM_REPO" ~/.config/nvim
|
|
fi
|
|
```
|
|
|
|
## config.json
|
|
|
|
Generate if not present. Adapt paths per machine (Mac uses
|
|
`~/Documents/`, `~/Developer/`, etc.). Template:
|
|
|
|
```json
|
|
{
|
|
"paths": {
|
|
"obsidianVault": "~/Documents/obsidian-vault/",
|
|
"srcDirectory": "~/Developer/",
|
|
"scriptsDirectory": "~/scripts/",
|
|
"wallpaperScript": "~/scripts/pywal/wallpapermenu.sh"
|
|
},
|
|
"editor": {
|
|
"tabSize": 4,
|
|
"scrollOffset": 8,
|
|
"theme": "wave"
|
|
},
|
|
"ai": {
|
|
"model": "claude-sonnet-4-5",
|
|
"openCodeModel": "anthropic/claude-sonnet-4-5"
|
|
},
|
|
"lsp": {
|
|
"servers": ["ts_ls", "eslint", "jsonls", "html", "cssls", "tailwindcss"]
|
|
},
|
|
"treesitter": {
|
|
"languages": ["lua", "vim", "bash", "javascript", "typescript", "tsx", "json", "yaml", "html", "css"]
|
|
}
|
|
}
|
|
```
|
|
|
|
## Dotfile Symlinks
|
|
|
|
```bash
|
|
ln -sf ~/.config/nvim/dotfiles/.tmux.conf ~/.tmux.conf
|
|
ln -sf ~/.config/nvim/dotfiles/starship.toml ~/.config/starship.toml
|
|
```
|
|
|
|
## Nvim Plugins
|
|
|
|
```bash
|
|
nvim --headless "+Lazy! sync" +qa 2>/dev/null || true
|
|
```
|
|
|
|
## Shell Aliases
|
|
|
|
Append to `~/.zshrc` if not already present (check for marker
|
|
comment `# Added by nvim dotfiles setup`). Include:
|
|
|
|
- Git shortcuts: gs, ga, gc, gp, gl
|
|
- Claude aliases: cldy, cldyh, cldys, cldyo
|
|
- Directory aliases: .., ..., ...., home, cd.., chpwd, mkdirg
|
|
- Editor: EDITOR=nvim, VISUAL=nvim, alias vim=nvim
|
|
- Prompt: `eval "$(starship init zsh)"`
|
|
|
|
## tmux Terminal Fix
|
|
|
|
Ensure tmux.conf has this line for backspace over SSH:
|
|
|
|
```
|
|
set -ga terminal-overrides ",*:Tc,*:kbs=\177"
|
|
```
|