nixos/Makefile

67 lines
1.8 KiB
Makefile
Raw Normal View History

CONFIG_DIR := $(if $(XDG_CONFIG_HOME), $(XDG_CONFIG_HOME), $(HOME)/.config)
SSH_DIR := $(HOME)/.ssh
THEMES_DIR := $(HOME)/.themes
CONFIG_ITEMS := $(wildcard config/*)
CONFIG_TARGETS := $(CONFIG_ITEMS:config/%=$(CONFIG_DIR)/%)
SSH_ITEMS := $(wildcard ssh/*)
SSH_TARGETS := $(SSH_ITEMS:ssh/%=$(SSH_DIR)/%)
THEMES_ITEMS := $(wildcard themes/*)
THEMES_TARGETS := $(THEMES_ITEMS:themes/%=$(THEMES_DIR)/%)
LAZY_REPO := https://github.com/folke/lazy.nvim.git
2023-02-17 09:07:24 +00:00
LAZY_DIR := $(HOME)/.local/share/nvim/lazy/lazy.nvim
PYENV_DIR := $(if $(PYENV_ROOT), $(PYENV_ROOT), $(HOME)/.pyenv)
POETRY_DIR := $(HOME)/.local/share/pypoetry
.PHONY: all clean check link unlink install uninstall pacman
all: link install
clean: unlink uninstall
check:
echo "Placeholder"
2023-03-01 17:18:35 +00:00
link: $(CONFIG_TARGETS) $(SSH_TARGETS) $(THEMES_TARGETS) $(HOME)/.bashrc $(HOME)/.ssh/sockets
unlink:
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
for link in $(THEMES_TARGETS); do rm "$$link"; done
rmdir $(HOME)/.ssh/sockets
install: $(LAZY_DIR) $(PYENV_DIR) $(POETRY_DIR) config/nvim/.venv
uninstall:
rm -rf $(LAZY_DIR)
rm -rf $(PYENV_DIR)
rm -rf $(POETRY_DIR)
rm -rf config/nvim/.venv
$(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/%
$(SSH_TARGETS): $(SSH_DIR)/%: ssh/%
$(THEMES_TARGETS): $(THEMES_DIR)/%: themes/%
2023-03-01 17:18:35 +00:00
$(HOME)/.bashrc: $(HOME)/%: %
$(CONFIG_TARGETS) $(SSH_TARGETS) $(THEMES_TARGETS) $(HOME)/.bashrc:
2023-02-25 08:56:04 +00:00
ln -s $(PWD)/$? -t $$(dirname $@)
2023-02-25 08:46:56 +00:00
$(LAZY_DIR):
git clone --depth 1 $(LAZY_REPO) $@
$(PYENV_DIR):
bash packages/pyenv.sh
$(POETRY_DIR):
python3 packages/poetry.py
config/nvim/.venv:
python3 -m venv $@
$@/bin/python3 -m pip install -U pip wheel
$@/bin/python3 -m pip install --use-pep517 pynvim
$(CONFIG_DIR) $(SSH_DIR) $(THEMES_DIR) $(HOME)/.ssh/sockets:
mkdir -p $@