nixos/Makefile

49 lines
1.2 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
2023-02-17 09:07:24 +00:00
LAZY_DIR := $(HOME)/.local/share/nvim/lazy/lazy.nvim
2023-02-11 10:02:36 +00:00
.PHONY: all clean link unlink install uninstall pacman
all: link install
clean: unlink uninstall
2023-02-25 15:43:39 +00:00
link: $(CONFIG_TARGETS) $(SSH_TARGETS) $(HOME)/.local/share/fonts $(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
2023-02-25 15:43:39 +00:00
rmdir $(HOME)/.local/share/fonts
rmdir $(HOME)/.ssh/sockets
2023-02-25 08:46:56 +00:00
install: $(LAZY_DIR)
uninstall:
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
$(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/%
$(SSH_TARGETS): $(SSH_DIR)/%: ssh/%
2023-02-25 08:46:56 +00:00
$(CONFIG_TARGETS) $(SSH_TARGETS):
2023-02-25 08:56:04 +00:00
ln -s $(PWD)/$? -t $$(dirname $@)
2023-02-25 08:46:56 +00:00
2023-02-25 15:43:39 +00:00
$(HOME)/.local/share/fonts: fonts
ln -s $(PWD)/$? -t $(HOME)/.local/share
$(LAZY_DIR):
git clone --depth 1 $(LAZY_REPO) $@
$(CONFIG_DIR) $(SSH_DIR) $(HOME)/.ssh/sockets:
mkdir -p $@