From 0699e44b60ccdd1c0ef15d8d12bff8648bd55ada Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Wed, 31 May 2023 09:57:29 +0100 Subject: [PATCH] Use rsync to move nixos config to /etc/nixos/config rather than cloning Add rsync command to nixos and update sections of Makefile --- .rsyncignore | 4 ++++ Makefile | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 .rsyncignore diff --git a/.rsyncignore b/.rsyncignore new file mode 100644 index 00000000..c806e2f8 --- /dev/null +++ b/.rsyncignore @@ -0,0 +1,4 @@ +.git* +.pre-commit-config.yaml +.stylua.toml +Makefile diff --git a/Makefile b/Makefile index 3b1ea7dc..c672b8b3 100644 --- a/Makefile +++ b/Makefile @@ -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)