45 lines
1.6 KiB
Makefile
45 lines
1.6 KiB
Makefile
$(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)
|
|
BIN_DIR := $(HOME)/.local/bin
|
|
HOMEMANAGER_CONFIG_DIR := $(CONFIG_DIR)/home-manager
|
|
|
|
.PHONY: default all clean nixos home legacy
|
|
|
|
default:
|
|
[ -e /etc/nixos/ ] && make nixos || make home
|
|
|
|
all: install nixos home
|
|
|
|
clean:
|
|
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/installers/nix.sh --daemon
|
|
|
|
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) $(BIN_DIR):
|
|
mkdir -p $@
|
|
|
|
legacy: $(CONFIG_DIR) $(BIN_DIR)
|
|
fc-list | grep -iE "(fira.*code)*(nerd.*font)" > /dev/null || ./scripts/installers/firacode.sh && fc-cache
|
|
command -v nvim > /dev/null || ./scripts/installers/nvim.sh
|
|
[ -e $(CONFIG_DIR)/nvim ] || ln -s $(PWD)/home/tui/config/nvim $(CONFIG_DIR)/
|
|
command -v starship > /dev/null || ./scripts/installers/starship.sh --yes --bin-dir $(HOME)/.local/bin
|
|
[ -e $(CONFIG_DIR)/starship.toml ] || ln -s $(PWD)/home/env/config/starship.toml $(CONFIG_DIR)/
|
|
command -v direnv > /dev/null || bin_path="$(BIN_DIR)" ./scripts/installers/direnv.sh
|