Add nixos and home-manager config linking to Makefile
This commit is contained in:
parent
57812c539b
commit
1ec85f8292
12
Makefile
12
Makefile
|
@ -1,4 +1,6 @@
|
|||
$(eval HOSTNAME=$(shell hostname))
|
||||
NIXOS_CONFIG := $(PWD)/nixos/$(HOSTNAME)-$(USER).nix
|
||||
HOMEMANAGER_CONFIG := $(PWD)/home/$(HOSTNAME)-$(USER).nix
|
||||
CONFIG_DIR := $(if $(XDG_CONFIG_HOME), $(XDG_CONFIG_HOME), $(HOME)/.config)
|
||||
SSH_DIR := $(HOME)/.ssh
|
||||
|
||||
|
@ -24,7 +26,7 @@ directories: $(CONFIG_DIR) $(SSH_DIR) $(CONFIG_DIR)/home-manager
|
|||
$(CONFIG_DIR) $(SSH_DIR) $(CONFIG_DIR)/home-manager:
|
||||
mkdir -p $@
|
||||
|
||||
link: $(CONFIG_TARGETS) $(SSH_DIR)/config.d $(HOME)/.inputrc $(CONFIG_DIR)/home-manager/home.nix
|
||||
link: $(CONFIG_TARGETS) $(SSH_DIR)/config.d $(HOME)/.inputrc
|
||||
|
||||
$(CONFIG_TARGETS): $(CONFIG_DIR)/%: config/%
|
||||
$(SSH_DIR)/config.d: $(SSH_DIR)/%: ssh/%
|
||||
|
@ -33,9 +35,13 @@ $(CONFIG_TARGETS) $(SSH_DIR)/config.d $(HOME)/.inputrc:
|
|||
ln -s $(PWD)/$? $@
|
||||
|
||||
$(CONFIG_DIR)/home-manager/home.nix:
|
||||
ln -s $(PWD)/home/$(HOSTNAME)-$(USER).nix $@
|
||||
ln -s $(HOMEMANAGER_CONFIG) $@
|
||||
|
||||
install: /nix
|
||||
install: /nix /etc/nixos/$(HOSTNAME)-$(USER).nix
|
||||
|
||||
/etc/nixos/$(HOSTNAME)-$(USER).nix:
|
||||
[ -f $(NIXOS_CONFIG) ] || touch $(NIXOS_CONFIG)
|
||||
sudo ln -s $(NIXOS_CONFIG) $@
|
||||
|
||||
/nix:
|
||||
command -v nix > /dev/null && echo "Nix already installed" || sh <(curl -L https://nixos.org/nix/install) --daemon
|
||||
|
|
Loading…
Reference in a new issue