dotfiles/Makefile

170 lines
7.1 KiB
Makefile
Raw Normal View History

2021-01-24 16:34:21 +01:00
SHELL = /bin/sh
HOMEDIR = ${HOME}
.PHONY: help all
.DEFAULT_GOAL := help
# This will output the help for each task
# thanks to https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help: ## This help
2021-01-24 17:03:09 +01:00
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[1;1;36m%-30s\033[1;0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
2021-01-24 16:34:21 +01:00
2021-01-24 16:49:12 +01:00
all: git-fetch git-secrets-reveal deploy-macos ## Update repo, decrypt secrets and run deploy-macos
2021-01-24 16:34:21 +01:00
2021-01-24 16:49:12 +01:00
install: git-fetch deploy-base ## Update repor and run deploy-base
deploy-base: deploy-htop-zfs deploy-tmux deploy-vim deploy-zsh deploy-ssh deploy-hushlogin ## Only deploy basic conf files for shell usage
2021-01-24 16:49:12 +01:00
deploy-workstation: deploy-base deploy-alacritty deploy-espanso deploy-vscodium deploy-youtubedl ## Deploy workstation specific config files (inherits deploy-shell)
deploy-macos: deploy-htop deploy-workstation deploy-bitbar deploy-duti deploy-skhd deploy-yabai deploy-brewfile ## Deploy macOS specific config files (inherits deploy-workstation)
2021-01-24 16:34:21 +01:00
gen-vscodium-plugin-list: ## Update the list of VSCodium plugins
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Updating the list of VSCodium plugins at .config/VSCodium/UserUser/extensions.list"
2021-01-24 16:34:21 +01:00
@code --list-extensions > .config/VSCodium/UserUser/extensions.list
git-secrets-hide: ## Hide secrets with git-secret
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Encrypting secrets."
2021-01-24 16:34:21 +01:00
@git secret hide
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Creating commit."
2021-01-24 16:34:21 +01:00
@git add -A && git commit -m "Updated secrets."
git-secrets-reveal: ## Reveal secrets with git-secret
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Decrypting secrets."
2021-01-24 16:34:21 +01:00
@git secret reveal
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Remove encrypted files."
2021-01-24 16:34:21 +01:00
@git secret clean
git-fetch: ## Fetch changes from origin
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Fetching changes from origin."
2021-01-24 16:34:21 +01:00
@git fetch origin main
git-push: ## Push changes to origin
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Pushing changes to origin."
2021-01-24 16:34:21 +01:00
@git push origin main
git-update-submodules: ## Update all submodules
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Updating git submodules."
2021-01-24 16:34:21 +01:00
@git submodule update --init --recursive && \
git submodule foreach git pull --recurse-submodules origin
brew-bundle: ## Install applications with brew bundle
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m\033[1;0m Installing applications from .config/Brewfile"
2021-01-24 16:34:21 +01:00
@brew bundle --file .config/Brewfile || true
brew-bundle-cleanup: ## Removew all appplications that are not listed in Brewfile
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Removing applications that are not listed in .config/Brewfile"
2021-01-24 16:34:21 +01:00
@brew bundle cleanup --zap --force --file .config/Brewfile
deploy-alacritty: ## Deploy alacritty config
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Deploy alacritty config to ${HOMEDIR}/.config/alacritty"
2021-01-24 16:34:21 +01:00
@mkdir -p ~/.config/alacritty
@cp .config/alacritty/* ${HOMEDIR}/.config/alacritty
deploy-bitbar: ## Deploy BitBar config
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Deploy BitBar config to ${HOMEDIR}/.config/BitBar"
2021-01-24 16:34:21 +01:00
@mkdir -p ${HOMEDIR}/.config/BitBar
@cp .config/BitBar/* ${HOMEDIR}/.config/BitBar
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Setting BitBar plugin directory to ${HOMEDIR}/.config/BitBar/Enabled"
2021-01-24 16:34:21 +01:00
@defaults write com.matryer.BitBar pluginsDirectory "${HOMEDIR}/.config/BitBar/Enabled"
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Enabeling BitBar plugins"
2021-01-24 16:34:21 +01:00
@mkdir -p ${HOMEDIR}/.config/BitBar/Enabled
@ln -sf ${HOMEDIR}/.config/BitBar/*.sh ${HOMEDIR}/.config/BitBar/Enabled
deploy-duti: ## Deploy duti config
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Deploy duti config to ${HOMEDIR}/.config/duti"
2021-01-24 16:34:21 +01:00
@mkdir -p ${HOMEDIR}/.config/duti
@cp .config/duti/* ${HOMEDIR}/.config/duti
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Processing duti config from ${HOMEDIR}/.config/duti"
2021-01-24 16:34:21 +01:00
@duti ${HOMEDIR}/.config/duti
deploy-espanso: ## Deploy espanso config
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Deploy espanso config to ${HOMEDIR}/.config/espanso"
2021-01-24 16:34:21 +01:00
@mkdir -p ${HOMEDIR}/.config/espanso/user
@cp .config/espanso/*.yml ${HOMEDIR}/.config/espanso
2021-01-24 16:49:12 +01:00
-@cp .config/espanso/user/*.yml ${HOMEDIR}/.config/espanso/user
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Enabeling espanso daemon"
2021-01-24 16:34:21 +01:00
@espanso register
deploy-htop: ## Deploy htop config
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Deploy htop config to ${HOMEDIR}/.config/htop"
2021-01-24 16:34:21 +01:00
@mkdir -p ${HOMEDIR}/.config/htop
@cp .config/htop/htoprc ${HOMEDIR}/.config/htop/htoprc
deploy-htop-zfs: ## Deploy htop config with zfs
@echo "\033[1;32m>>>\033[1;0m Deploy htop config to ${HOMEDIR}/.config/htop"
@mkdir -p ${HOMEDIR}/.config/htop
@cp .config/htop/htoprc.zfs ${HOMEDIR}/.config/htop/htoprc
2021-01-24 16:34:21 +01:00
deploy-skhd: ## Deploy skhd config
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Deploy skhd config to ${HOMEDIR}/.config/skhd"
2021-01-24 16:34:21 +01:00
@mkdir -p ${HOMEDIR}/.config/skhd
@cp .config/skhd/skhdrc ${HOMEDIR}/.config/skhd
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Enabeling skhd daemon"
@brew services restart skhd
2021-01-24 16:34:21 +01:00
deploy-tmux: ## Deploy tmux config
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Deploy tmux config to ${HOMEDIR}/.config/tmux"
2021-01-24 16:34:21 +01:00
@mkdir -p ${HOMEDIR}/.config/tmux
@cp .config/tmux/*.conf ${HOMEDIR}/.config/tmux
deploy-vim: ## Deploy vim config
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Deploy vim config to ${HOMEDIR}/.config/vim"
2021-01-24 16:34:21 +01:00
@mkdir -p ${HOMEDIR}/.config/vim
@mkdir -p ${HOMEDIR}/.config/vim/autoload
@mkdir -p ${HOMEDIR}/.config/vim/backup
@mkdir -p ${HOMEDIR}/.config/vim/colors
@mkdir -p ${HOMEDIR}/.config/vim/plugged
@mkdir -p ${HOMEDIR}/.config/vim/swap
@mkdir -p ${HOMEDIR}/.config/vim/undo
@cp .config/vim/vimrc ${HOMEDIR}/.config/vim
deploy-vscodium: ## Deploy VSCodium config
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Deploy VSCodium config to ${HOMEDIR}/.config/VSCodium/User"
2021-01-24 16:34:21 +01:00
@mkdir -p ${HOMEDIR}/.config/VSCodium/User
@cp .config/VSCodium/User/*.json ${HOMEDIR}/.config/VSCodium/User
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Install VSCodium extensions from ${HOMEDIR}/.config/VSCodium/User/extensions.list"
2021-01-24 16:34:21 +01:00
@cat .config/VSCodium/User/extensions.list | xargs -L 1 code --install-extension
deploy-yabai: ## Deploy yabai config
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Deploy yabai config to ${HOMEDIR}/.config/yabai"
2021-01-24 16:34:21 +01:00
@mkdir -p ${HOMEDIR}/.config/yabai
@cp .config/yabai/yabairc ${HOMEDIR}/.config/yabai
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Enabeling yabai daemon"
@brew services restart yabai
2021-01-24 16:34:21 +01:00
deploy-youtubedl: ## Deploy youtube-dl config
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Deploy youtube-dl config to ${HOMEDIR}/.config/youtube-dl"
2021-01-24 16:34:21 +01:00
@mkdir -p ${HOMEDIR}/.config/youtube-dl
@cp .config/youtube-dl/config ${HOMEDIR}/.config/youtube-dl
deploy-zsh: ## Deploy zsh config
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Deploy zsh config to ${HOMEDIR}/.config/zsh"
2021-01-24 16:34:21 +01:00
@mkdir -p ${HOMEDIR}/.config/zsh
@mkdir -p ${HOMEDIR}/.config/zsh/functions
@mkdir -p ${HOMEDIR}/.config/zsh/lib
@cp .zshenv ${HOMEDIR}/
@cp .config/zsh/.z* ${HOMEDIR}/.config/zsh
@cp .config/zsh/functions/* ${HOMEDIR}/.config/zsh/functions
@cp .config/zsh/lib/*.zsh ${HOMEDIR}/.config/zsh/lib
deploy-brewfile: ## Deploy Brewfile
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Deploy Brewfile to ${HOMEDIR}/.config/"
2021-01-24 16:34:21 +01:00
@mkdir -p ${HOMEDIR}/.config
@cp .config/Brewfile ${HOMEDIR}/.config/
deploy-ssh: ## Deploy SSH config
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Deploy SSH config to ${HOMEDIR}/.ssh"
2021-01-24 16:34:21 +01:00
@mkdir -p ${HOMEDIR}/.ssh/master
@mkdir -p ${HOMEDIR}/.ssh/conf.d
@cp .ssh/config ${HOMEDIR}/.ssh/
2021-01-24 16:49:12 +01:00
-@cp .ssh/conf.d/*.conf ${HOMEDIR}/.ssh/conf.d
2021-01-24 16:34:21 +01:00
deploy-hushlogin: ## Deploy .hushlogin
2021-01-24 17:03:09 +01:00
@echo "\033[1;32m>>>\033[1;0m Deploy .hushlogin to ${HOMEDIR}"
@cp .hushlogin ${HOMEDIR}/