nixos/Makefile

41 lines
1.1 KiB
Makefile
Raw Normal View History

$(eval HOSTNAME=$(shell hostname))
NIXOS_CONFIG := $(PWD)/$(HOSTNAME).nix
HOMEMANAGER_CONFIG := $(PWD)/home/$(HOSTNAME)-$(USER).nix
CONFIG_DIR := $(if $(XDG_CONFIG_HOME), $(XDG_CONFIG_HOME), $(HOME)/.config)
HOMEMANAGER_CONFIG_DIR := $(CONFIG_DIR)/home-manager
2023-05-04 13:02:05 +01:00
.PHONY: default all clean nixos home nvim
default:
[ -e /etc/nixos/ ] && make nixos || make home
all: install nixos home
clean:
2023-04-11 10:14:55 +01:00
rm -rf $(HOME)/.local/share/nvim
rm -rf $(HOME)/.local/state/nvim
[ -e $(HOMEMANAGER_CONFIG_DIR) ] && rm -rf $(HOMEMANAGER_CONFIG_DIR)
/nix:
command -v nix > /dev/null && echo "Nix already installed" || ./scripts/install_nix.sh --daemon
2023-04-29 12:35:56 +01:00
nixos: /etc/nixos/$(HOSTNAME).nix
/etc/nixos/$(HOSTNAME).nix: /nix
[ -f $(NIXOS_CONFIG) ] || touch $(NIXOS_CONFIG)
sudo ln -s $(NIXOS_CONFIG) $@
home: $(HOMEMANAGER_CONFIG_DIR)/home.nix
$(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 $@
2023-05-04 13:02:05 +01:00
nvim: $(CONFIG_DIR)/nvim
$(CONFIG_DIR)/nvim: $(CONFIG_DIR)
ln -s $(PWD)/home/tui/config/nvim $@