Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,16 @@ jobs:
XDG_CONFIG_HOME: ${{ github.workspace }}
steps:
- uses: actions/checkout@v3
- run: rm ~/.bashrc ~/.bash_profile
# not brew packages as it's annoying to do the $PATH changes after install....
- run: make setup-ubuntu -o brew-pkgs
macos:
runs-on: macos-latest
env:
XDG_CONFIG_HOME: ${{ github.workspace }}
NIXPKGS_ALLOW_BROKEN: 1
steps:
- uses: actions/checkout@v3
- run: rm ~/.bashrc ~/.bash_profile
# not brew packages as it's annoying to do the $PATH changes after install....
- run: make setup-macos -o brew-pkgs
42 changes: 12 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,51 +1,46 @@
default:
@echo "hello ^^"

.PHONY: setup-macos setup-ubuntu setup-wsl setup-common setup-stow
.PHONY: setup-common setup-macos setup-ubuntu setup-wsl

setup-common:
bash ./tmux/setup.sh
bash ./zsh/setup.sh
bash ./fzf/setup.sh
bash ./scripts/setup-extras.sh

setup-macos: export OS=macos
setup-macos: brew-pkgs nix-pkgs dotfiles setup-common
setup-macos: brew-pkgs dotfiles setup-common setup-python
bash ./macos/setup.sh

setup-ubuntu: export OS=ubuntu
setup-ubuntu: dotfiles nix-pkgs dotfiles setup-common
setup-ubuntu: brew-pkgs dotfiles setup-common
bash ./ubuntu/setup.sh

setup-wsl: export OS=wsl
setup-wsl: dotfiles nix-pkgs dotfiles setup-common
setup-wsl: dotfiles setup-common

.PHONY: setup-stow dotfiles

STOW_ARGS=-vv
setup-stow:
bash ./stow/setup.sh

.PHONY: dotfiles test

STOW_ARGS=-vv
dotfiles: setup-stow
stow "$(STOW_ARGS)" -d dotfiles -t "$(HOME)"$(OS)
stow "$(STOW_ARGS)" -d dotfiles -t "$(HOME)" "$(OS)"
stow "$(STOW_ARGS)" dotfiles
stow "$(STOW_ARGS)" yabai
ln -sf ~/dotfiles/fish ~/.config/fish\

test: nix-pkgs
. ./nix/load-"$(OS)".sh && bash ./tests/*.sh

.PHONY: setup-uv python js
.PHONY: setup-uv python

setup-uv:
bash ./python/setup-uv.sh

python: setup-uv
setup-python: setup-uv
cd ~ && ~/.local/bin/uv venv --python 3.11.9
~/.local/bin/uv pip install -r ./python/pyproject.toml

js:
npm install -g remark-cli remark-lint remark-preset-lint-consistent remark-preset-lint-markdown-style-guide remark-preset-lint-recommended remark-stringify jsonlint jshint sql-language-server @tailwindcss/language-server markserv

.PHONY: clean-nvim setup-vim

clean-nvim:
Expand All @@ -60,24 +55,11 @@ setup-vim:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
"vim" +PluginInstall +qall

.PHONY: setup-nix nix-pkgs

setup-nix:
curl -L https://nixos.org/nix/install | sh
. ./nix/load-"$(OS)".sh && nix-channel --add https://nixos.org/channels/nixpkgs-unstable unstable
. ./nix/load-"$(OS)".sh && nix-channel --update

NIX_ARGS=--extra-experimental-features nix-command --extra-experimental-features flakes
nix-pkgs: setup-nix
. ./nix/load-"$(OS)".sh && cd nix && nix flake update "$(NIX_ARGS)" && (nix profile upgrade "$(NIX_ARGS)" nix || nix profile install "$(NIX_ARGS)" .)

.PHONY: setup-brew brew-pkgs

setup-brew:
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash
brew update; brew upgrade

brew-pkgs: setup-brew
brew install hadolint vale actionlint mactex pandoc fzf keychain wordnet entr
brew install koekeishiya/formulae/yabai
brew install koekeishiya/formulae/skhd
brew bundle --file ~/dotfiles/brew/Brewfile --no-upgrade
42 changes: 24 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@

Setup and configuration for my terminal based developer workflow (MacOS/Ubuntu):

- Zsh for a shell
- Nix for package management of shell programs
- uv for Python
- Neovim for text editing
- Stow for dotfiles management
- **Zsh** for a shell
- **Homebrew** for shell tools
- **mise** for programming language runtimes (except Python)
- **uv** for Python runtime and virtual environments
- **Neovim** for text editing
- **Stow** for dotfiles symlinking

This repo should be cloned into `$HOME` and set as `$XDG_CONFIG_HOME`.
This repo should be cloned into `$HOME` and set as `$XDG_CONFIG_HOME`. Many tools rely on setting this for the config stored in this repo to work. For other config that requires files in `$HOME` (such as `$HOME/.bashrc`) Stow is used to symlimk files.

You can setup your machine using commands in `Makefile`. Commonly setting up a machine involves:

- Installing packages with Nix or Homebrew
- Installing packages with Homebrew
- Setting up symlinks with Stow
- Setting up tmux & Zsh
- Installing language runtimes with mise

## Use

Expand All @@ -30,20 +32,24 @@ This will also setup dependencies with Nix.

### macOS

Setup an macOS machine:
Setup a macOS machine:

```shell-session
$ make setup-macos
```

This will also setup dependencies with Nix.
This will:
- Install Homebrew if not already installed
- Install all packages from the Brewfile
- Setup dotfiles with Stow
- Configure tmux, Zsh, and fzf

### Python

Install `uv` and setup a global Python installation in a virtual environment:

```bash
$ make python
$ make setup-python
```

## Components
Expand All @@ -70,21 +76,21 @@ You can run the setup without bootstrapping Stow with:
$ make dotfiles OS=macos -o setup-stow
```

### Nix
### Homebrew

Install packages with Nix from a Nix Flake - I use Nix for things like direnv and Neovim:
Install packages with Homebrew from the Brewfile:

```shell-session
$ make nix-pkgs
$ make brew-pkgs
```

This will setup dependencies with Nix from `./nix/flake.nix`.
This will:
- Install Homebrew if not already installed
- Install all packages defined in `./brew/Brewfile`

It will also install Nix itself. Nix doesn't like to be installed multiple times - you can avoid this step with:
### mise

```shell-session
$ make nix-pkgs -o setup-nix
```
mise is used for managing programming language runtime versions (Python, Node.js, Go, etc.). It's automatically installed via the Brewfile and activated in Zsh via an `eval`.

### Neovim

Expand Down
113 changes: 113 additions & 0 deletions brew/Brewfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
tap "hudochenkov/sshpass"
tap "koekeishiya/formulae"
tap "nikitabobko/tap"

# Core tools
brew "bash"
brew "git"
brew "neovim"
brew "tmux"
brew "zsh"

# GNU utils
brew "coreutils"
brew "findutils"
brew "grep"
brew "gnu-sed"
brew "make"

# Shell & terminal
brew "bat"
brew "direnv"
brew "mise"
brew "fd"
brew "fzf"
brew "htop"
brew "jq"
brew "lsd"
brew "ripgrep"
brew "starship"
brew "tig"
brew "tree"
brew "wget"
brew "zoxide"

# Language servers & linters
brew "actionlint"
brew "codespell"
brew "efm-langserver"
brew "golangci-lint"
brew "gopls"
brew "hadolint"
brew "jsonlint"
brew "ltex-ls"
brew "lua-language-server"
brew "marksman"
brew "shellcheck"
brew "shellharden"
brew "sql-language-server"
brew "stylua"
brew "tailwindcss-language-server"
brew "vale"
brew "yamllint"

# Dev tools
brew "cmake"
# brew "deno"
brew "difftastic"
brew "entr"
brew "gh"
brew "just"
brew "lazydocker"
brew "lazygit"
brew "llvm"
brew "stow"

# Build deps & libs
brew "bzip2"
brew "cairo"
brew "gtk4"
brew "libffi"
brew "open-mpi"
brew "openjdk@17"
brew "pango"
brew "pkgconf"
brew "swig"
brew "xz"
brew "zlib"

# Apps & utilities
brew "cbonsai"
brew "csvlens"
brew "duckdb"
brew "ffmpeg"
brew "fish"
brew "flyctl"
brew "glow"
brew "go-task"
brew "httpie"
brew "hugo"
brew "imagemagick"
brew "keychain"
brew "pandoc"
brew "syncthing", restart_service: :changed
brew "weasyprint"
brew "wordnet"
# brew "yarn"

# Taps
brew "hudochenkov/sshpass/sshpass"
brew "koekeishiya/formulae/skhd"
brew "koekeishiya/formulae/yabai"

# Casks
cask "amethyst"
cask "claude-code"
cask "darktable"
cask "dockdoor"
cask "font-fira-code-nerd-font"
cask "font-hack-nerd-font"
cask "mactex"

brew "markdownlint-cli"
cask "copilot-cli"
1 change: 1 addition & 0 deletions dotfiles/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,4 @@ pre
temp
temp.*
temp
**/.mypy_cache
7 changes: 4 additions & 3 deletions dotfiles/common/.zshenv
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
bash $HOME/dotfiles/scripts/trace.sh "$0"
if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
. '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
fi
# if [ -e '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh' ]; then
# . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
# fi
# Moved mise activation to .zshrc for interactive shells only (performance optimization)
export EDITOR=$(which nvim)
export XDG_CONFIG_HOME=$HOME/dotfiles
if command -v launchctl >/dev/null 2>&1; then
Expand Down
37 changes: 31 additions & 6 deletions dotfiles/common/.zshrc
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ atuin_init() {

fpath=($HOME/dotfiles/zsh/custom-autocomplete/ $fpath)
autoload -U compinit
compinit
# Use cached completion dump for faster loading (skip security check)
compinit -C
autoload -Uz $HOME/dotfiles/zsh/custom-autocomplete/todo

export HISTFILE=~/.zsh_history
Expand All @@ -70,17 +71,41 @@ source ~/dotfiles/macos/pyenv-flags
export IPYTHONDIR="$HOME/dotfiles/.ipython"

# need a fancy npm setup when npm manages nix - requires a .npmrc with a prefix
export PATH=~/.npm-packages/bin:$PATH
export NODE_PATH=~/.npm-packages/lib/node_modules
export PATH="/nix/var/nix/profiles/default/bin:$HOME/.nix-profile/bin:$PATH"
# export PATH=~/.npm-packages/bin:$PATH
# export NODE_PATH=~/.npm-packages/lib/node_modules
# export PATH="/nix/var/nix/profiles/default/bin:$HOME/.nix-profile/bin:$PATH"

pyenv_init
starship_init
flyctl_init

eval "$(zoxide init zsh)"
# Lazy-load mise for faster startup (only initialize on first use)
mise() {
unfunction mise
eval "$(command mise activate zsh)"
mise "$@"
}

# Lazy-load zoxide (only initialize on first use of z/zi commands)
z() {
unfunction z zi 2>/dev/null
eval "$(zoxide init zsh)"
z "$@"
}
zi() {
unfunction z zi 2>/dev/null
eval "$(zoxide init zsh)"
zi "$@"
}

eval "$(ssh-agent)" &>/dev/null &>/dev/null
eval "$(direnv hook zsh)"

# Lazy-load direnv (only initialize on first cd)
direnv() {
unfunction direnv
eval "$(command direnv hook zsh)"
direnv "$@"
}

# done twice for a reason
pretzo_init
Expand Down
1 change: 1 addition & 0 deletions dotfiles/common/setup-path.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export PATH="$HOME/dotfiles/scripts:$PATH"
export PATH="$HOME/personal/area/scripts:$PATH"
export PATH="$HOME/go/bin:$PATH"
export PATH="$HOME/.local/bin:$PATH"
export PATH="$HOME/.npm-packages/bin:$PATH"
export GOPATH="$HOME/go"
Loading
Loading