Skip to content

Commit

Permalink
docs: update Makefile targets & setup steps
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Doster <mvdoster@gmail.com>
  • Loading branch information
vladdoster committed Jul 1, 2022
1 parent 11b95b8 commit 4a8d2cf
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 120 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RUN apt-get update \
file \
git g++ \
make \
ncurses-base ncurses-bin \
subversion sudo \
tar \
unzip \
Expand Down
65 changes: 31 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
CONTAINER_NAME:=dotfiles

help: ## Display all Makfile targets
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
@grep -E '^.*[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
| awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'

install:
CONFIGS:= hammerspoon neovim
Expand All @@ -19,7 +19,7 @@ $(CONFIGS): ## Clone a program's configuration repository
sh -c "[ -d $(destination) ] || git clone $(GH_URL)/$@-configuration $(destination)"

install: | clean ## Deploy dotfiles via GNU install
find * -maxdepth 0 -mindepth 0 -type d -print -exec stow --verbose 1 --stow --target $$HOME {} \;
find * -maxdepth 0 -mindepth 0 -type d -exec stow --verbose 1 --stow --target $$HOME {} \;

update: clean
git pull --autostash --quiet
Expand All @@ -29,9 +29,7 @@ update: clean
container/build: ## Build container && install dotfiles
# docker buildx create --use --name dotfiles-builder || echo "--- exists"
docker volume create configuration
docker build \
--tag=$(CONTAINER_NAME):latest \
.
docker build --tag=$(CONTAINER_NAME):latest .
# docker buildx build \
# --platform=darwin/arm64e\
# --load \
Expand Down Expand Up @@ -59,16 +57,14 @@ brew/fix: ## Re-install Linuxbrew taps homebrew-core & homebrew-cask
@git -C "/home/linuxbrew/.linuxbrew/Homebrew" remote add origin https://github.com/Homebrew/brew
brew tap homebrew/core homebrew/cask

rust/install: ## Install Rust & Cargo pkg manager via Rustup
@curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

rust/uninstall: ## Uninstall Rust via rustup utility
@rustup self uninstall

install/all: python/prog rust/prog ## Install Python & Rust programs

prog/all: py-prog rust-prog ## Install Python & Rust programs
install/gnu-stow: ## Install GNU stow
$(info --- installing GNU Stow)
$(shell pushd ./bin/.local/bin; make stow)
$(info --- installed GNU Stow)

prog/python: ## Install Python dependencies
python/prog: ## Install useful Python programs
@python3 -m pip install --upgrade pip
@python3 -m pip install --upgrade --trusted-host pypi.org --trusted-host files.pythonhosted.org --no-compile \
autopep8 \
Expand All @@ -80,7 +76,7 @@ prog/python: ## Install Python dependencies
reorder-python-imports
$(info --- py packages installed)

pip-update: ## Update Python3 packages
python/update: ## Update installed Python3 packages
@pip3 list --user \
| cut -d" " -f 1 \
| tail -n +3 \
Expand All @@ -91,29 +87,30 @@ pip-update: ## Update Python3 packages
--upgrade \
--user

prog-rust: ## Install programs via rust
cargo install \
bat \
cargo-update \
exa \
topgrade
rust/install: ## Install Rust & Cargo pkg manager via Rustup
@curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

stow-install: ## Install GNU stow
$(info --- installing GNU stow)
cd ./bin/.local/bin \
&& make stow
$(info --- installed GNU stow)
rust/prog: ## Install useful Rust programs
cargo install bat cargo-update exa topgrade

rust/uninstall: ## Uninstall Rust via rustup
@rustup self uninstall

clean: ## Remove deployed dotfiles
clean/nvim:
rm -rf $$HOME/.{cache,config/nvim/lua/plugins,local/share/nvim}
$(info --- removed nvim artifacts)

clean/dotfiles:
find * -maxdepth 0 -mindepth 0 -type d -exec stow --verbose 1 --target $$HOME --delete {} \;
$(info --- uninstalled dotfiles)

clean: clean/nvim clean/dotfiles ## Remove installed dotfiles
find $$PWD -type f -name ".DS_Store" -print -delete
$(info --- cleaned .DS_Store files)
find * -maxdepth 0 -mindepth 0 -type d -print -exec stow --verbose 1 --target $$HOME --delete {} \;
$(info --- removed linked dotfiles)
rm -rf $$HOME/.{cache,config/nvim/lua/plugins,local/share/nvim}
$(info --- removed files generated by nvim & zsh)

# A catch-all target to make fake targets
%:
@true

.PHONY: CONFIGS all clean hammerspoon install neovim test
.SILENT: brew-install clean container/build container/run stow

%: ## A catch-all target to make fake targets
@true
52 changes: 28 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# macOS
# Dotfiles

![Release Version](https://img.shields.io/github/v/release/vladdoster/dotfiles)
[![Release Status](https://github.com/vladdoster/dotfiles/actions/workflows/release.yml/badge.svg)](https://github.com/vladdoster/dotfiles/actions/workflows/release.yml)
Expand All @@ -7,42 +7,46 @@

Program configuration files are managed by GNU Stow.

Supports GNU Linux && macOS (Apple silicon, Intel)

## Install

Install and set everything up, run:

```bash
git clone https://github.com/vladdoster/dotfiles $HOME/.config/dotfiles
make stow-install
make install
```zsh
mkdir $HOME/.config \
&& git clone https://github.com/vladdoster/dotfiles $HOME/.config/dotfiles \
&& make stow-install \
&& make install

# Reload Zsh process
exec zsh
```

## Makefile targets

| TARGET | DESCRIPTION |
| :-------------: | ----------------------------------------------------------- |
| all-prog | Install Python & Rust programs |
| brew-bundle | Install programs defined in $HOME/.config/dotfiles/Brewfile |
| brew-fix | Re-install Homebrew taps homebrew-core & homebrew-cask |
| brew-install | Install Homebrew pkg manager |
| brew-uninstall | Uninstall Homebrew pkg manager |
| build-container | Build containerized env and install dotfiles |
| clean | Remove deployed dotfiles |
| help | Display available Makfile targets |
| install | Deploy dotfiles via GNU install |
| linuxbrew-fix | Re-install Linuxbrew taps homebrew-core & homebrew-cask |
| pip-update | Update Python packages |
| py-prog | Install Python dependencies |
| rust-install | Install Rust & Cargo pkg manager via Rustup |
| rust-prog | Install programs via rust |
| rust-uninstall | Uninstall Rust |
| stow | Install GNU stow |
| TARGET | DESCRIPTION |
| ---------------- | ------------------------------------------------------------- |
| brew | (Un)install Homebrew |
| brew/bundle | Install programs defined in `$HOME/.config/dotfiles/Brewfile` |
| brew/fix | Re-install taps homebrew-core & homebrew-cask |
| clean | Remove installed dotfiles |
| container/build | Build container && install dotfiles |
| container/run | Run containerized dockerfiles env |
| help | Display all Makfile targets |
| install | Deploy dotfiles via GNU install |
| install/all | Install Python & Rust programs |
| install/gnu-stow | Install GNU stow |
| python/prog | Install useful Python programs |
| python/update | Update installed Python3 packages |
| rust/install | Install Rust & Cargo pkg manager via Rustup |
| rust/prog | Install useful Rust programs |
| rust/uninstall | Uninstall Rust via rustup |

## Change shell to ZSH

##### Linux

```bash
```zsh
sudo chsh --shell "$(which zsh)" "$USER"
```
18 changes: 0 additions & 18 deletions bin/.local/bin/nuke-docker.sh

This file was deleted.

2 changes: 2 additions & 0 deletions git/.config/git/config
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[init]
defaultBranch = main
[advice]
skippedCherryPicks = false
[user]
Expand Down
82 changes: 40 additions & 42 deletions zsh/.config/zsh/zinit.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ if [[ -e $ZINIT[BIN_DIR]/zinit.zsh ]]; then
else error "unable to find 'zinit.zsh'" && return 1
fi
#=== STATIC ZSH BINARY =======================================
# zi for atpull"%atclone" depth"1" lucid nocompile nocompletions as"null" \
# atclone"./install -e no -d ~/.local" atinit"export PATH=$HOME/.local/bin:$PATH" \
# @romkatv/zsh-bin
zi for atpull"%atclone" depth"1" lucid nocompile nocompletions as"null" \
atclone"./install -e no -d ~/.local" atinit"export PATH=$HOME/.local/bin:$PATH" \
@romkatv/zsh-bin
# #=== OH-MY-ZSH & PREZTO PLUGINS =======================
zi for is-snippet \
OMZL::{'clipboard','compfix','completion','git','grep','key-bindings'}.zsh \
Expand All @@ -52,23 +52,21 @@ install_completion 'fd-completion/_fd' 'sharkdp/fd/master/contrib/comple
#=== PROMPT ===========================================
zi light-mode for \
compile'(pure|async).zsh' multisrc'(pure|async).zsh' atinit"
PURE_GIT_DOWN_ARROW='↓'; PURE_GIT_UP_ARROW='↑'
PURE_PROMPT_SYMBOL='ᐳ'; PURE_PROMPT_VICMD_SYMBOL='ᐸ'
zstyle ':prompt:pure:git:action' color 'yellow'
zstyle ':prompt:pure:git:branch' color 'blue'
zstyle ':prompt:pure:git:dirty' color 'red'
zstyle ':prompt:pure:path' color 'cyan'
zstyle ':prompt:pure:prompt:success' color 'green'" \
PURE_GIT_DOWN_ARROW='↓'; PURE_GIT_UP_ARROW='↑'
PURE_PROMPT_SYMBOL='ᐳ'; PURE_PROMPT_VICMD_SYMBOL='ᐸ'
zstyle ':prompt:pure:git:action' color 'yellow'
zstyle ':prompt:pure:git:branch' color 'blue'
zstyle ':prompt:pure:git:dirty' color 'red'
zstyle ':prompt:pure:path' color 'cyan'
zstyle ':prompt:pure:prompt:success' color 'green'" \
sindresorhus/pure
#=== zsh-vim-mode cursor configuration [[[
MODE_CURSOR_VICMD="green block"; MODE_CURSOR_VIINS="#20d08a blinking bar"
MODE_INDICATOR_REPLACE='%F{9}%F{1}REPLACE%f'; MODE_INDICATOR_VISUAL='%F{12}%F{4}VISUAL%f'
MODE_INDICATOR_VIINS='%F{15}%F{8}INSERT%f'; MODE_INDICATOR_VICMD='%F{10}%F{2}NORMAL%f'
MODE_INDICATOR_VLINE='%F{12}%F{4}V-LINE%f'; MODE_CURSOR_SEARCH="#ff00ff blinking underline"
export KEYTIMEOUT=1; export LESS='-RMs'; export PAGER=less; export VISUAL=vi;
LC_CTYPE=en_US.UTF-8; LC_ALL=en_US.UTF-8
# Setting for the new UTF-8 terminal support in Lion
RPS1='${MODE_INDICATOR_PROMPT} ${vcs_info_msg_0_}'
# LC_CTYPE=en_US.UTF-8; LC_ALL=en_US.UTF-8
#=== ANNEXES ==========================================
zi light-mode for "$ZI_REPO"/zinit-annex-{'bin-gem-node','binary-symlink','patch-dl','submods'}
#=== GITHUB BINARIES ==================================
Expand All @@ -85,17 +83,17 @@ zi from'gh-r' lbin'!' nocompile for \
lbin'!**/rg' @BurntSushi/ripgrep \
lbin'!**/bin/nvim' ver'nightly' @neovim/neovim \
lbin'!**/exa' atinit"alias l='exa -blF';
alias la='exa -abghilmu'; alias ll='exa -al'
alias ls='exa --git --group-directories-first'" \
alias la='exa -abghilmu'; alias ll='exa -al'
alias ls='exa --git --group-directories-first'" \
@ogham/exa
#=== UNIT TESTING =====================================
zi as'command' for \
pick'src/semver' \
vladdoster/semver-tool \
vladdoster/semver-tool \
pick'revolver' \
@molovo/revolver \
@molovo/revolver \
atclone'./build.zsh' pick'zunit' \
@zdharma-continuum/zunit
@zdharma-continuum/zunit
#=== COMPILED PROGRAMS ================================
zi lucid make'PREFIX=$PWD install' nocompile for \
lbin'!**/bin/tree' Old-Man-Programmer/tree \
Expand All @@ -120,8 +118,8 @@ _pip_completion() {
))}; compctl -K _pip_completion pip3
#=== MISC. ============================================
zi light-mode lucid for \
atinit"
bindkey -M vicmd '^v' edit-command-line" \
atinit"
bindkey -M vicmd '^v' edit-command-line" \
compile'zsh-vim-mode*.zsh' \
softmoth/zsh-vim-mode \
thewtex/tmux-mem-cpu-load \
Expand All @@ -133,37 +131,37 @@ zi light-mode lucid for \
zsh-users/zsh-completions \
atload'_zsh_autosuggest_start' \
atinit"
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=50
bindkey '^_' autosuggest-execute
bindkey '^ ' autosuggest-accept" \
ZSH_AUTOSUGGEST_BUFFER_MAX_SIZE=50
bindkey '^_' autosuggest-execute
bindkey '^ ' autosuggest-accept" \
zsh-users/zsh-autosuggestions \
atclone'(){local f;cd -q →*;for f (*~*.zwc){zcompile -Uz -- ${f}};}' \
atload'FAST_HIGHLIGHT[chroma-man]=' atpull'%atclone' \
compile'.*fast*~*.zwc' nocompletions \
$ZI_REPO/fast-syntax-highlighting
zi for \
as'null' id-as'zinit/cleanup' lucid nocd wait'!' \
atload'
zicompinit; zicdreplay
_zsh_highlight_bind_widgets
_zsh_autosuggest_bind_widgets' \
as'null' id-as'zinit/cleanup' lucid nocd wait'!' \
atload'
zicompinit; zicdreplay
_zsh_highlight_bind_widgets
_zsh_autosuggest_bind_widgets' \
/dev/null
#=== COMPILE ZSH SOURCE =======================================
zi for atpull'%atclone' nocompile as'null' atclone'
{ print -P "%F{blue}[INFO]%f:%F{cyan}Building Zsh %f" \
&& autoreconf --force --install --make || ./Util/preconfig \
&& CFLAGS="-g -O3" ./configure --prefix=/usr/local >/dev/null \
&& print -P "%F{blue}[INFO]%f:%F{cyan} Configured Zsh %f" \
&& make -j8 PREFIX=/usr/local >/dev/null || make \
&& print -P "%F{blue}[INFO]%f:%F{green} Compiled $(/usr/local/bin/zsh --version) %f" \
&& sudo make -j8 install >/dev/null || make \
&& print -P "%F{blue}[INFO]%f:%F{green} Installed $(/usr/local/bin/zsh --version) @ /usr/local/bin/zsh %f" \
&& print -P "%F{blue}[INFO]%f:%F{green} Adding /usr/local/bin/zsh to /etc/shells %f" \
sudo sh -c "echo /usr/bin/local/zsh >> /etc/shells" \
&& print -P "%F{blue}[INFO]%f: To update your shell, run: %F{cyan} chsh --shell /usr/local/bin/zsh $USER %f"
} || { print -P "%F{red}[ERROR]%f:%F{yellow} Failed to install Zsh %f" }' \
zsh-users/zsh
# zi for atpull'%atclone' nocompile as'null' atclone'
# { print -P "%F{blue}[INFO]%f:%F{cyan}Building Zsh %f" \
# && autoreconf --force --install --make || ./Util/preconfig \
# && CFLAGS="-g -O3" ./configure --prefix=/usr/local >/dev/null \
# && print -P "%F{blue}[INFO]%f:%F{cyan} Configured Zsh %f" \
# && make -j8 PREFIX=/usr/local >/dev/null || make \
# && print -P "%F{blue}[INFO]%f:%F{green} Compiled $(/usr/local/bin/zsh --version) %f" \
# && sudo make -j8 install >/dev/null || make \
# && print -P "%F{blue}[INFO]%f:%F{green} Installed $(/usr/local/bin/zsh --version) @ /usr/local/bin/zsh %f" \
# && print -P "%F{blue}[INFO]%f:%F{green} Adding /usr/local/bin/zsh to /etc/shells %f" \
# sudo sh -c "echo /usr/bin/local/zsh >> /etc/shells" \
# && print -P "%F{blue}[INFO]%f: To update your shell, run: %F{cyan} chsh --shell /usr/local/bin/zsh $USER %f"
# } || { print -P "%F{red}[ERROR]%f:%F{yellow} Failed to install Zsh %f" }' \
# zsh-users/zsh

# vim:ft=zsh:sw=2:sts=2
3 changes: 1 addition & 2 deletions zsh/.zshenv
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,5 @@ export DOCKER_BUILDKIT=0
export HOMEBREW_NO_AUTO_UPDATE=1
export HOMEBREW_NO_ENV_HINTS=1
export HOMEBREW_NO_INSTALL_CLEANUP=1
export KEYTIMEOUT=1
export ZSH_AUTOSUGGEST_MANUAL_REBIND=1 # make prompt faster
# export ZSH_AUTOSUGGEST_MANUAL_REBIND=1 # make prompt faster
# vim:ft=zsh:sw=2:sts=2

0 comments on commit 4a8d2cf

Please sign in to comment.