update Makefile

This commit is contained in:
Henri Dohmen 2025-03-19 09:07:24 +01:00
parent c23f441e9d
commit b0de91ee26

View file

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