nixos/Makefile

71 lines
2.1 KiB
Makefile
Raw Normal View History

CONFIG_DIR := $(if $(XDG_CONFIG_HOME), $(XDG_CONFIG_HOME), $(HOME)/.config)
FONT_DIR := $(HOME)/.local/share/fonts
ZSH_DIR := $(if $(ZSH), $(ZSH), $(HOME)/.oh-my-zsh)
SSH_DIR := $(HOME)/.ssh
ZSH_CUSTOM_DIR := $(if $(ZSH_CUSTOM), $(ZSH_CUSTOM), $(ZSH_DIR)/custom)
HOME_ITEMS := $(wildcard home/*)
HOME_TARGETS := $(HOME_ITEMS:home/%=$(HOME)/.%)
CONFIG_ITEMS := $(wildcard config/*)
CONFIG_TARGETS := $(CONFIG_ITEMS:config/%=$(CONFIG_DIR)/%)
ZSH_ITEMS := $(wildcard ohmyzsh/*.zsh)
ZSH_TARGETS := $(ZSH_ITEMS:ohmyzsh/%.zsh=$(ZSH_CUSTOM_DIR)/%.zsh)
SSH_ITEMS := $(wildcard ssh/*)
SSH_TARGETS := $(SSH_ITEMS:ssh/%=$(SSH_DIR)/%)
PACKER_REPO := https://github.com/wbthomason/packer.nvim
PACKER_DIR := $(HOME)/.local/share/nvim/site/pack/packer/start/packer.nvim
POWERLEVEL_REPO := https://github.com/romkatv/powerlevel10k.git
POWERLEVEL_DIR := $(ZSH_CUSTOM_DIR)/themes/powerlevel10k
TPM_REPO := https://github.com/tmux-plugins/tpm
TPM_DIR := $(HOME)/.tmux/plugins/tpm
.PHONY: install nopackages clean home packages config zsh ssh nvim
install: home packages config zsh ssh nvim
nopackages: home config zsh ssh nvim
clean:
for link in $(HOME_TARGETS); do rm "$$link"; done
2023-01-30 22:30:02 +00:00
for link in $(CONFIG_TARGETS); do rm "$$link"; done
rm $(HOME)/.ssh/config
rm -rf $(PACKER_DIR)
rm -rf $(ZSH_DIR)
home: $(HOME_TARGETS)
packages:
pacman -T - < pkglist.txt || sudo pacman --needed -S - < pkglist.txt
config: $(CONFIG_TARGETS) $(TPM_DIR)
zsh: $(ZSH_DIR) $(POWERLEVEL_DIR) $(ZSH_TARGETS)
2023-01-27 19:36:54 +00:00
ssh: $(SSH_TARGETS) $(HOME)/.ssh/sockets
2023-01-30 10:31:06 +00:00
nvim: $(PACKER_DIR)
$(HOME_TARGETS): $(HOME)/.%: home/%
$(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/%
$(ZSH_TARGETS): $(ZSH_CUSTOM_DIR)/%.zsh: ohmyzsh/%.zsh
$(SSH_TARGETS): $(SSH_DIR)/%: ssh/%
$(HOME_TARGETS) $(CONFIG_TARGETS) $(ZSH_TARGETS) $(SSH_TARGETS):
ln -s $(PWD)/$? $@
$(PACKER_DIR):
git clone --depth 1 $(PACKER_REPO) $@
$(POWERLEVEL_DIR): $(ZSH_DIR)
git clone --depth 1 $(POWERLEVEL_REPO) $@
$(TPM_DIR):
git clone --depth 1 $(TPM_REPO) $@
$(ZSH_DIR):
sh -c "$$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
$(CONFIG_DIR) $(FONT_DIR) $(SSH_DIR) $(HOME)/.ssh/sockets:
mkdir -p $@