.PHONY: init rebuild update purge help

REPO_DIR := $(shell pwd)

GREEN := \033[0;32m
YELLOW := \033[0;33m
RED := \033[0;31m
NC := \033[0m

help:
	@echo "NixOS Config"
	@echo ""
	@echo "  make init     - first time setup"
	@echo "  make rebuild  - rebuild nixos with flakes"
	@echo "  make update   - update flake inputs and rebuild"
	@echo "  make purge    - garbage collect"

init:
	@./scripts/init.sh

rebuild:
	git add .
	sudo nixos-rebuild switch --flake .#lavitz

update:
	nix flake update
	@$(MAKE) --no-print-directory rebuild

purge:
	sudo nix-collect-garbage -d
	sudo /run/current-system/bin/switch-to-configuration boot
