system/Makefile

71 lines
1.1 KiB
Makefile
Raw Normal View History

2022-11-30 23:38:47 +03:00
NIX_RUN := sudo nix run .\#
NIX_LOCK := nix flake lock
DEPS_MY := \
myneovim \
vnetod \
2023-07-03 23:17:33 +03:00
yagpt_tg_bot
2022-11-30 23:38:47 +03:00
DEPS_NIXOS := \
nixpkgs \
nixpkgs-unstable \
2022-11-30 23:38:47 +03:00
hardware \
home-manager \
agenix
DEPS_MISC := \
wired \
nil \
mailserver
MACHINES := \
home \
asus-gl553vd
VPS := \
2023-07-29 17:21:48 +03:00
istal \
tatos
2022-11-30 23:38:47 +03:00
.PHONY: help
2022-11-30 23:38:47 +03:00
help:
2023-11-24 01:19:13 +03:00
bat -p Makefile
2022-11-30 23:38:47 +03:00
define machine_rule
.PHONY: $(1)
2023-01-04 23:43:54 +03:00
$(1): ;
systemctl --user reset-failed
$$(NIX_RUN)switch/$(1)
.PHONY: rollback-$(1)
rollback-$(1):
$$(NIX_RUN)rollback/$(1)
.PHONY: test-$(1)
test-$(1): ; $$(NIX_RUN)test/$(1)
2022-11-30 23:38:47 +03:00
endef
define vps_rule
.PHONY: $(1)
2022-12-01 11:10:13 +03:00
$(1): ; $$(NIX_RUN)deploy/$(1)
.PHONY: rollback-$(1)
rollback-$(1):
$$(NIX_RUN)rollback/$(1)
2022-11-30 23:38:47 +03:00
endef
$(foreach machine,$(MACHINES),$(eval $(call machine_rule,$(machine))))
$(foreach vps,$(VPS),$(eval $(call vps_rule,$(vps))))
.PHONY: deps-my
deps-my:
2022-11-30 23:38:47 +03:00
$(NIX_LOCK) $(foreach dep,$(DEPS_MY),--update-input $(dep))
.PHONY: deps-nixos
deps-nixos:
2022-11-30 23:38:47 +03:00
$(NIX_LOCK) $(foreach dep,$(DEPS_NIXOS),--update-input $(dep))
.PHONY: deps-misc
deps-misc:
2022-11-30 23:38:47 +03:00
$(NIX_LOCK) $(foreach dep,$(DEPS_MISC),--update-input $(dep))