nixos/Makefile

40 lines
1 KiB
Makefile
Raw Normal View History

CONFIG_DIR := $(if $(XDG_CONFIG_HOME), $(XDG_CONFIG_HOME), $(HOME)/.config)
SSH_DIR := $(HOME)/.ssh
CONFIG_ITEMS := $(wildcard config/*)
CONFIG_TARGETS := $(CONFIG_ITEMS:config/%=$(CONFIG_DIR)/%)
SSH_ITEMS := $(wildcard ssh/*)
SSH_TARGETS := $(SSH_ITEMS:ssh/%=$(SSH_DIR)/%)
LAZY_REPO := https://github.com/folke/lazy.nvim.git
.PHONY: default all clean check directories link install
default: directories link
all: default install
clean:
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
rm -rf $(LAZY_DIR)
directories: $(CONFIG_DIR) $(SSH_DIR)
$(CONFIG_DIR) $(SSH_DIR):
mkdir -p $@
2023-04-03 16:46:18 +01:00
link: $(CONFIG_TARGETS) $(SSH_DIR)/config.d $(HOME)/.inputrc $(HOME)/.i3_scripts
$(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/%
2023-03-31 13:14:08 +01:00
$(SSH_DIR)/config.d: $(SSH_DIR)/%: ssh/%
$(HOME)/.inputrc: $(HOME)/%: %
2023-04-03 16:46:18 +01:00
$(HOME)/.i3_scripts: $(HOME)/.%: %
$(CONFIG_TARGETS) $(SSH_DIR)/config.d $(HOME)/.inputrc $(HOME)/.i3_scripts:
ln -s $(PWD)/$? $@
2023-02-25 08:46:56 +00:00
install: $(LAZY_DIR)
$(LAZY_DIR):
git clone --depth 1 $(LAZY_REPO) $@