From 8383f7d019e0f9684e733e3f11cf5c5c29f26e00 Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Thu, 9 Feb 2023 08:53:40 +0000 Subject: [PATCH] Move dotfiles from HOME into sub directory, make discovery automatic like config --- Makefile | 39 ++++++++++++++++++-------------------- .p10k.zsh => home/p10k.zsh | 0 {config => home}/tmux.conf | 0 .zprofile => home/zprofile | 0 .zshrc => home/zshrc | 0 5 files changed, 18 insertions(+), 21 deletions(-) rename .p10k.zsh => home/p10k.zsh (100%) rename {config => home}/tmux.conf (100%) rename .zprofile => home/zprofile (100%) rename .zshrc => home/zshrc (100%) diff --git a/Makefile b/Makefile index d29c779f..41d15fdf 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,8 @@ 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) +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) @@ -14,38 +16,35 @@ 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 +.PHONY := install clean home packages config zsh ssh nvim -install: config packages +install: home packages config zsh ssh nvim -config: $(CONFIG_TARGETS) zsh ssh nvim +clean: + for link in $(HOME_TARGETS); do rm "$$link"; done + for link in $(CONFIG_TARGETS); do rm "$$link"; done + rm $(HOME)/.ssh/config + rm -rf $(PACKER_DIR) + rm -rf $(ZSH_DIR) + +home: $(HOME_TARGETS) packages: pacman -T - < pkglist.txt || sudo pacman --needed -S - < pkglist.txt -clean: - for link in $(CONFIG_TARGETS); do rm "$$link"; done - for link in $(ZSH_TARGETS); do rm "$$link"; done - rm $(HOME)/.zprofile - rm $(HOME)/.zshrc - rm $(HOME)/.p10k.zsh - rm $(HOME)/.ssh/config - rm -rf $(PACKER_DIR) - rm -rf $(POWERLEVEL_DIR) +config: $(CONFIG_TARGETS) -zsh: $(HOME)/.zprofile $(HOME)/.zshrc $(ZSH_DIR) $(ZSH_CUSTOM_DIR) $(POWERLEVEL_DIR) $(HOME)/.p10k.zsh $(ZSH_TARGETS) +zsh: $(ZSH_DIR) $(POWERLEVEL_DIR) $(ZSH_TARGETS) ssh: $(HOME)/.ssh/config $(HOME)/.ssh/sockets $(HOME)/.ssh/config.d nvim: $(PACKER_DIR) +$(HOME_TARGETS): $(HOME)/.%: home/% $(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/% $(ZSH_TARGETS): $(ZSH_CUSTOM_DIR)/%.zsh: ohmyzsh/%.zsh -$(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: +$(HOME_TARGETS) $(CONFIG_TARGETS) $(ZSH_TARGETS) $(HOME)/.ssh/config: ln -s $(PWD)/$? $@ $(PACKER_DIR): @@ -54,10 +53,8 @@ $(PACKER_DIR): $(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) +$(POWERLEVEL_DIR): $(ZSH_DIR) git clone --depth 1 $(POWERLEVEL_REPO) $@ -$(LOCAL_BIN) $(CONFIG_DIR) $(FONT_DIR) $(HOME)/.ssh $(HOME)/.ssh/sockets $(HOME)/.ssh/config.d: +$(LOCAL_BIN) $(CONFIG_DIR) $(FONT_DIR) $(HOME)/.ssh/sockets $(HOME)/.ssh/config.d: mkdir -p $@ diff --git a/.p10k.zsh b/home/p10k.zsh similarity index 100% rename from .p10k.zsh rename to home/p10k.zsh diff --git a/config/tmux.conf b/home/tmux.conf similarity index 100% rename from config/tmux.conf rename to home/tmux.conf diff --git a/.zprofile b/home/zprofile similarity index 100% rename from .zprofile rename to home/zprofile diff --git a/.zshrc b/home/zshrc similarity index 100% rename from .zshrc rename to home/zshrc