52 lines
1.4 KiB
Makefile
52 lines
1.4 KiB
Makefile
$(eval HOSTNAME=$(shell hostname))
|
|
NIXOS_REPO := https://git.xenia.me.uk/xenia/nixos.git
|
|
NVIM_REPO := https://git.xenia.me.uk/xenia/nvim.git
|
|
HYPR_REPO := https://git.xenia.me.uk/xenia/hyprland.git
|
|
WAYBAR_REPO := https://git.xenia.me.uk/xenia/waybar.git
|
|
HOMEMANAGER_CONFIG := $(PWD)/home/$(HOSTNAME)/$(USER).nix
|
|
CONFIG_DIR := $(if $(XDG_CONFIG_HOME), $(XDG_CONFIG_HOME), $(HOME)/.config)
|
|
BIN_DIR := $(HOME)/.local/bin
|
|
HOMEMANAGER_CONFIG_DIR := $(CONFIG_DIR)/home-manager
|
|
|
|
.PHONY: default all clean nixos home nvim hypr waybar
|
|
|
|
default:
|
|
[ -e /etc/nixos/ ] && make nixos || make home
|
|
|
|
all: default nvim
|
|
|
|
clean:
|
|
[ -e $(HOMEMANAGER_CONFIG_DIR) ] && rm -rf $(HOMEMANAGER_CONFIG_DIR)
|
|
|
|
nixos: /etc/nixos/config hypr waybar
|
|
|
|
home: $(HOMEMANAGER_CONFIG_DIR)/home.nix
|
|
|
|
nvim: $(CONFIG_DIR)/nvim
|
|
|
|
hypr: $(CONFIG_DIR)/hypr
|
|
|
|
waybar: $(CONFIG_DIR)/waybar
|
|
|
|
/nix:
|
|
command -v nix > /dev/null || echo "Install nix package manager before continuing"; exit 1
|
|
|
|
/etc/nixos/config:
|
|
sudo git clone $(NIXOS_REPO) $@
|
|
|
|
$(HOMEMANAGER_CONFIG_DIR)/home.nix: $(HOMEMANAGER_CONFIG_DIR) /nix
|
|
[ -f $(HOMEMANAGER_CONFIG) ] || touch $(HOMEMANAGER_CONFIG)
|
|
ln -s $(HOMEMANAGER_CONFIG) $@
|
|
|
|
$(CONFIG_DIR) $(HOMEMANAGER_CONFIG_DIR) $(BIN_DIR):
|
|
mkdir -p $@
|
|
|
|
$(CONFIG_DIR)/nvim: $(CONFIG_DIR)
|
|
git clone $(NVIM_REPO) $@
|
|
|
|
$(CONFIG_DIR)/hypr: $(CONFIG_DIR)
|
|
git clone $(HYPR_REPO) $@
|
|
|
|
$(CONFIG_DIR)/waybar: $(CONFIG_DIR)
|
|
git clone $(WAYBAR_REPO) $@
|