update Makefile
This commit is contained in:
parent
c23f441e9d
commit
b0de91ee26
1 changed files with 11 additions and 4 deletions
13
Makefile
13
Makefile
|
|
@ -1,15 +1,22 @@
|
|||
HOST ?= $(shell hostname)
|
||||
HOSTS = solo c2
|
||||
|
||||
_all:
|
||||
@true
|
||||
.PHONY: _all $(addprefix, _swtich_,${HOSTS}) _swtich_
|
||||
.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 .#$*
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue