2023-04-18 08:44:46 +01:00
|
|
|
$(eval HOSTNAME=$(shell hostname))
|
2023-05-28 20:21:16 +01:00
|
|
|
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
|
2023-05-16 09:58:47 +01:00
|
|
|
HOMEMANAGER_CONFIG := $(PWD)/home/$(HOSTNAME)/$(USER).nix
|
2023-01-27 11:29:28 +00:00
|
|
|
CONFIG_DIR := $(if $(XDG_CONFIG_HOME), $(XDG_CONFIG_HOME), $(HOME)/.config)
|
2023-05-05 14:07:12 +01:00
|
|
|
BIN_DIR := $(HOME)/.local/bin
|
2023-05-04 12:29:07 +01:00
|
|
|
HOMEMANAGER_CONFIG_DIR := $(CONFIG_DIR)/home-manager
|
2023-01-27 11:29:28 +00:00
|
|
|
|
2023-05-31 09:57:29 +01:00
|
|
|
.PHONY: default update clean nixos home nvim hypr waybar /etc/nixos/config
|
2023-01-27 11:29:28 +00:00
|
|
|
|
2023-05-25 10:00:49 +01:00
|
|
|
default: nvim hypr waybar
|
2023-05-04 12:29:07 +01:00
|
|
|
[ -e /etc/nixos/ ] && make nixos || make home
|
2023-02-09 16:05:24 +00:00
|
|
|
|
2023-05-25 10:00:49 +01:00
|
|
|
update: $(CONFIG_DIR)/nvim $(CONFIG_DIR)/hypr $(CONFIG_DIR)/waybar
|
2023-05-28 20:21:16 +01:00
|
|
|
git -C $(CONFIG_DIR)/nvim remote set-url origin $(NVIM_REPO)
|
|
|
|
git -C $(CONFIG_DIR)/hypr remote set-url origin $(HYPR_REPO)
|
|
|
|
git -C $(CONFIG_DIR)/waybar remote set-url origin $(WAYBAR_REPO)
|
2023-05-25 10:00:49 +01:00
|
|
|
for repo in $?; do git -C $$repo pull --ff-only; done
|
2023-05-31 09:57:29 +01:00
|
|
|
[ -e /etc/nixos/ ] && make /etc/nixos/config
|
2023-02-10 08:13:48 +00:00
|
|
|
|
2023-03-05 22:16:16 +00:00
|
|
|
clean:
|
2023-05-04 12:29:07 +01:00
|
|
|
[ -e $(HOMEMANAGER_CONFIG_DIR) ] && rm -rf $(HOMEMANAGER_CONFIG_DIR)
|
2023-03-04 09:08:14 +00:00
|
|
|
|
2023-05-25 10:00:49 +01:00
|
|
|
nixos: /etc/nixos/config
|
2023-03-02 16:08:39 +00:00
|
|
|
|
2023-05-04 12:29:07 +01:00
|
|
|
home: $(HOMEMANAGER_CONFIG_DIR)/home.nix
|
2023-04-20 11:40:30 +01:00
|
|
|
|
2023-05-16 09:58:47 +01:00
|
|
|
nvim: $(CONFIG_DIR)/nvim
|
|
|
|
|
2023-05-24 09:17:43 +01:00
|
|
|
hypr: $(CONFIG_DIR)/hypr
|
|
|
|
|
2023-05-25 09:31:56 +01:00
|
|
|
waybar: $(CONFIG_DIR)/waybar
|
|
|
|
|
2023-05-16 09:58:47 +01:00
|
|
|
/nix:
|
|
|
|
command -v nix > /dev/null || echo "Install nix package manager before continuing"; exit 1
|
|
|
|
|
|
|
|
/etc/nixos/config:
|
2023-05-31 09:57:29 +01:00
|
|
|
sudo rsync -avz --exclude-from=.rsyncignore --delete-during --delete-excluded ./ $@
|
2023-05-16 09:58:47 +01:00
|
|
|
|
2023-05-04 12:29:07 +01:00
|
|
|
$(HOMEMANAGER_CONFIG_DIR)/home.nix: $(HOMEMANAGER_CONFIG_DIR) /nix
|
|
|
|
[ -f $(HOMEMANAGER_CONFIG) ] || touch $(HOMEMANAGER_CONFIG)
|
|
|
|
ln -s $(HOMEMANAGER_CONFIG) $@
|
|
|
|
|
2023-05-05 14:07:12 +01:00
|
|
|
$(CONFIG_DIR) $(HOMEMANAGER_CONFIG_DIR) $(BIN_DIR):
|
2023-05-04 12:29:07 +01:00
|
|
|
mkdir -p $@
|
2023-05-04 13:02:05 +01:00
|
|
|
|
2023-05-16 09:58:47 +01:00
|
|
|
$(CONFIG_DIR)/nvim: $(CONFIG_DIR)
|
2023-05-26 13:00:52 +01:00
|
|
|
[ -d $@ ] && touch $@ || git clone $(NVIM_REPO) $@
|
2023-05-24 09:17:43 +01:00
|
|
|
|
|
|
|
$(CONFIG_DIR)/hypr: $(CONFIG_DIR)
|
2023-05-26 13:00:52 +01:00
|
|
|
[ -d $@ ] && touch $@ || git clone $(HYPR_REPO) $@ | continue
|
2023-05-25 09:31:56 +01:00
|
|
|
|
|
|
|
$(CONFIG_DIR)/waybar: $(CONFIG_DIR)
|
2023-05-26 13:00:52 +01:00
|
|
|
[ -d $@ ] && touch $@ || git clone $(WAYBAR_REPO) $@ | continue
|