2023-04-18 08:44:46 +01:00
|
|
|
$(eval HOSTNAME=$(shell hostname))
|
2023-05-04 12:37:53 +01:00
|
|
|
NIXOS_CONFIG := $(PWD)/$(HOSTNAME).nix
|
|
|
|
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-04 12:29:07 +01:00
|
|
|
HOMEMANAGER_CONFIG_DIR := $(CONFIG_DIR)/home-manager
|
2023-01-27 11:29:28 +00:00
|
|
|
|
2023-05-04 12:37:53 +01:00
|
|
|
.PHONY: default all clean nixos home
|
2023-01-27 11:29:28 +00:00
|
|
|
|
2023-05-04 12:29:07 +01:00
|
|
|
default:
|
|
|
|
[ -e /etc/nixos/ ] && make nixos || make home
|
2023-02-09 16:05:24 +00:00
|
|
|
|
2023-05-04 12:29:07 +01:00
|
|
|
all: install nixos home
|
2023-02-10 08:13:48 +00:00
|
|
|
|
2023-03-05 22:16:16 +00:00
|
|
|
clean:
|
2023-04-11 10:14:55 +01:00
|
|
|
rm -rf $(HOME)/.local/share/nvim
|
2023-05-04 12:29:07 +01:00
|
|
|
rm -rf $(HOME)/.local/state/nvim
|
|
|
|
[ -e $(HOMEMANAGER_CONFIG_DIR) ] && rm -rf $(HOMEMANAGER_CONFIG_DIR)
|
2023-03-04 09:08:14 +00:00
|
|
|
|
2023-05-04 12:29:07 +01:00
|
|
|
/nix:
|
|
|
|
command -v nix > /dev/null && echo "Nix already installed" || ./scripts/install_nix.sh --daemon
|
2023-04-18 08:44:46 +01:00
|
|
|
|
2023-04-29 12:35:56 +01:00
|
|
|
nixos: /etc/nixos/$(HOSTNAME).nix
|
2023-04-18 10:01:37 +01:00
|
|
|
|
2023-04-28 11:50:11 +01:00
|
|
|
/etc/nixos/$(HOSTNAME).nix: /nix
|
2023-04-18 10:01:37 +01:00
|
|
|
[ -f $(NIXOS_CONFIG) ] || touch $(NIXOS_CONFIG)
|
|
|
|
sudo ln -s $(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-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) $@
|
|
|
|
|
|
|
|
$(CONFIG_DIR) $(HOMEMANAGER_CONFIG_DIR):
|
|
|
|
mkdir -p $@
|