nixos/Makefile

64 lines
2 KiB
Makefile
Raw Normal View History

LOCAL_BIN := $(HOME)/.local/bin
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)
ZSH_CUSTOM_DIR := $(if $(ZSH_CUSTOM), $(ZSH_CUSTOM), $(ZSH_DIR)/custom)
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)
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
.PHONY := all config packages clean zsh ssh nvim
install: config packages
2023-01-27 14:00:09 +00:00
config: $(CONFIG_TARGETS) zsh ssh nvim
packages:
sudo pacman --needed -S - < pkglist.txt
clean:
2023-01-30 22:30:02 +00:00
for link in $(CONFIG_TARGETS); do rm "$$link"; done
for link in $(ZSH_TARGETS); do rm "$$link"; done
2023-02-03 09:08:12 +00:00
rm $(HOME)/.zprofile
rm $(HOME)/.zshrc
rm $(HOME)/.p10k.zsh
rm $(HOME)/.ssh/config
rm -rf $(PACKER_DIR)
rm -rf $(POWERLEVEL_DIR)
zsh: $(HOME)/.zprofile $(HOME)/.zshrc $(ZSH_DIR) $(ZSH_CUSTOM_DIR) $(POWERLEVEL_DIR) $(HOME)/.p10k.zsh $(ZSH_TARGETS)
2023-01-27 19:36:54 +00:00
ssh: $(HOME)/.ssh/config $(HOME)/.ssh/sockets $(HOME)/.ssh/config.d
2023-01-30 10:31:06 +00:00
nvim: $(PACKER_DIR)
$(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/%
$(ZSH_TARGETS): $(ZSH_CUSTOM_DIR)/%.zsh: ohmyzsh/%.zsh
2023-02-03 09:08:12 +00:00
$(HOME)/.zprofile: .zprofile
$(HOME)/.zshrc: .zshrc
$(HOME)/.p10k.zsh: .p10k.zsh
$(HOME)/.ssh/config: $(HOME)/.ssh/%: ssh-%
$(CONFIG_TARGETS) $(ZSH_TARGETS) $(HOME)/.zprofile $(HOME)/.zshrc $(HOME)/.p10k.zsh $(HOME)/.ssh/config:
ln -s $(PWD)/$? $@
$(PACKER_DIR):
git clone --depth 1 $(PACKER_REPO) $@
$(ZSH_DIR):
sh -c "$$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
$(ZSH_CUSTOM_DIR): $(ZSH_DIR)
$(POWERLEVEL_DIR): $(ZSH_CUSTOM_DIR)
git clone --depth 1 $(POWERLEVEL_REPO) $@
$(LOCAL_BIN) $(CONFIG_DIR) $(FONT_DIR) $(HOME)/.ssh $(HOME)/.ssh/sockets $(HOME)/.ssh/config.d:
mkdir -p $@