Use rsync to move nixos config to /etc/nixos/config rather than cloning

Add rsync command to nixos and update sections of Makefile
This commit is contained in:
Evie Litherland-Smith 2023-05-31 09:57:29 +01:00
parent 1db5364696
commit 0699e44b60
2 changed files with 7 additions and 3 deletions

4
.rsyncignore Normal file
View file

@ -0,0 +1,4 @@
.git*
.pre-commit-config.yaml
.stylua.toml
Makefile

View file

@ -1,5 +1,4 @@
$(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
@ -8,7 +7,7 @@ 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 update clean nixos home nvim hypr waybar
.PHONY: default update clean nixos home nvim hypr waybar /etc/nixos/config
default: nvim hypr waybar
[ -e /etc/nixos/ ] && make nixos || make home
@ -18,6 +17,7 @@ update: $(CONFIG_DIR)/nvim $(CONFIG_DIR)/hypr $(CONFIG_DIR)/waybar
git -C $(CONFIG_DIR)/hypr remote set-url origin $(HYPR_REPO)
git -C $(CONFIG_DIR)/waybar remote set-url origin $(WAYBAR_REPO)
for repo in $?; do git -C $$repo pull --ff-only; done
[ -e /etc/nixos/ ] && make /etc/nixos/config
clean:
[ -e $(HOMEMANAGER_CONFIG_DIR) ] && rm -rf $(HOMEMANAGER_CONFIG_DIR)
@ -36,7 +36,7 @@ waybar: $(CONFIG_DIR)/waybar
command -v nix > /dev/null || echo "Install nix package manager before continuing"; exit 1
/etc/nixos/config:
sudo git clone $(NIXOS_REPO) $@
sudo rsync -avz --exclude-from=.rsyncignore --delete-during --delete-excluded ./ $@
$(HOMEMANAGER_CONFIG_DIR)/home.nix: $(HOMEMANAGER_CONFIG_DIR) /nix
[ -f $(HOMEMANAGER_CONFIG) ] || touch $(HOMEMANAGER_CONFIG)