Makefile can clone repository to root user in NixOS

This commit is contained in:
Evie Litherland-Smith 2023-05-09 17:29:04 +01:00
parent 75d40775aa
commit b0f78102c6

View file

@ -1,5 +1,5 @@
$(eval HOSTNAME=$(shell hostname))
NIXOS_CONFIG := $(PWD)/$(HOSTNAME).nix
CONFIG_REPO := git@gitlab.com:elitherl/nixos.git
HOMEMANAGER_CONFIG := $(PWD)/home/$(HOSTNAME)-$(USER).nix
CONFIG_DIR := $(if $(XDG_CONFIG_HOME), $(XDG_CONFIG_HOME), $(HOME)/.config)
BIN_DIR := $(HOME)/.local/bin
@ -20,11 +20,10 @@ clean:
/nix:
command -v nix > /dev/null && echo "Nix already installed" || ./scripts/installers/nix.sh --daemon
nixos: /etc/nixos/$(HOSTNAME).nix
/etc/nixos/config:
sudo git clone $(CONFIG_REPO) /etc/nixos/config
/etc/nixos/$(HOSTNAME).nix: /nix
[ -f $(NIXOS_CONFIG) ] || touch $(NIXOS_CONFIG)
sudo ln -s $(NIXOS_CONFIG) $@
nixos: /etc/nixos/config
home: $(HOMEMANAGER_CONFIG_DIR)/home.nix