cfg/Makefile
2025-03-27 00:00:05 +01:00

21 lines
407 B
Makefile

HOST ?= $(shell hostname)
HOSTS = solo c2
.PHONY: all switch $(addprefix, _swtich_,${HOSTS}) _swtich_
.SUFFIXES:
all:
@echo "Run \`make switch\` as root to rebuild and switch"
@true
switch: _switch_${HOST}
_switch_:
@echo "ERROR: couldn't find hostname"
@false
_switch_%:
@if [ "$(shell whoami)" != "root" ]; then \
echo "ERROR: Run as root!"; \
false; \
fi
nixos-rebuild switch --flake .#$*