nixos/Makefile

77 lines
2.4 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)/%)
LAZY_REPO := https://github.com/folke/lazy.nvim.git
LAZY_DIR := /home/tux/.local/share/nvim/lazy/lazy.nvim
POWERLEVEL_REPO := https://github.com/romkatv/powerlevel10k.git
POWERLEVEL_DIR := $(ZSH_CUSTOM_DIR)/themes/powerlevel10k
2023-02-14 22:38:38 +00:00
ZSH_SYNTAX_REPO := https://github.com/zsh-users/zsh-syntax-highlighting.git
ZSH_SYNTAX_DIR := $(ZSH_CUSTOM_DIR)/plugins/zsh-syntax-highlighting
TPM_REPO := https://github.com/tmux-plugins/tpm
TPM_DIR := $(HOME)/.tmux/plugins/tpm
2023-02-11 10:02:36 +00:00
.PHONY: all clean link unlink install uninstall pacman
all: link install
clean: unlink uninstall
2023-02-10 08:14:10 +00:00
link: $(HOME_TARGETS) $(CONFIG_TARGETS) $(SSH_TARGETS) $(HOME)/.ssh/sockets
unlink:
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
for link in $(SSH_TARGETS); do rm "$$link"; done
rmdir $(HOME)/.ssh/sockets
install: $(ZSH_DIR) $(POWERLEVEL_DIR) $(ZSH_SYNTAX_DIR) $(ZSH_TARGETS) $(LAZY_DIR) $(TPM_DIR)
python3 -m pip list | grep -E "libtmux.*0\.16\.1" > /dev/null ||\
python3 -m pip install --user libtmux==0.16.1
uninstall:
rm -rf $(ZSH_DIR)
rm -rf $(LAZY_DIR)
2023-02-11 10:02:36 +00:00
pacman:
sort -h pkglist.txt -o pkglist.txt
pacman -T - < pkglist.txt ||\
sudo pacman --needed -S - < pkglist.txt
$(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)/$? $@
$(LAZY_DIR):
git clone --depth 1 $(LAZY_REPO) $@
$(POWERLEVEL_DIR): $(ZSH_DIR)
git clone --depth 1 $(POWERLEVEL_REPO) $@
2023-02-14 22:38:38 +00:00
$(ZSH_SYNTAX_DIR): $(ZSH_DIR)
git clone --depth 1 $(ZSH_SYNTAX_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) $(SSH_DIR) $(HOME)/.ssh/sockets:
mkdir -p $@