2024-02-18 23:08:50 +03:00
|
|
|
NIX_RUN := nix run .\#
|
2022-11-30 23:38:47 +03:00
|
|
|
NIX_LOCK := nix flake lock
|
|
|
|
|
|
|
|
DEPS_MY := \
|
|
|
|
myneovim \
|
2024-03-28 15:16:04 +03:00
|
|
|
vnetod
|
2022-11-30 23:38:47 +03:00
|
|
|
|
|
|
|
DEPS_NIXOS := \
|
|
|
|
nixpkgs \
|
2023-03-31 17:40:22 +03:00
|
|
|
nixpkgs-unstable \
|
2022-11-30 23:38:47 +03:00
|
|
|
hardware \
|
|
|
|
home-manager \
|
|
|
|
agenix
|
|
|
|
|
|
|
|
DEPS_MISC := \
|
|
|
|
wired \
|
2024-03-28 15:16:04 +03:00
|
|
|
nil
|
2022-11-30 23:38:47 +03:00
|
|
|
|
|
|
|
MACHINES := \
|
|
|
|
home \
|
|
|
|
asus-gl553vd
|
|
|
|
|
|
|
|
VPS := \
|
2023-07-29 17:21:48 +03:00
|
|
|
istal \
|
|
|
|
tatos
|
2022-11-30 23:38:47 +03:00
|
|
|
|
2023-03-19 19:10:06 +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
|
|
|
|
2024-03-29 18:27:33 +03:00
|
|
|
################################################################################
|
|
|
|
# Hosts
|
|
|
|
################################################################################
|
|
|
|
|
2022-11-30 23:38:47 +03:00
|
|
|
define machine_rule
|
2023-03-19 19:10:06 +03:00
|
|
|
.PHONY: $(1)
|
2023-01-04 23:43:54 +03:00
|
|
|
$(1): ;
|
|
|
|
systemctl --user reset-failed
|
2024-02-18 23:08:50 +03:00
|
|
|
sudo $$(NIX_RUN)switch/$(1)
|
2022-11-30 23:38:47 +03:00
|
|
|
endef
|
|
|
|
|
|
|
|
define vps_rule
|
2023-03-19 19:10:06 +03:00
|
|
|
.PHONY: $(1)
|
2022-12-01 11:10:13 +03:00
|
|
|
$(1): ; $$(NIX_RUN)deploy/$(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))))
|
|
|
|
|
2024-03-29 18:27:33 +03:00
|
|
|
.PHONY: rollback
|
|
|
|
rollback:
|
|
|
|
sudo nixos-rebuild --rollback
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# Deps
|
|
|
|
################################################################################
|
|
|
|
|
2023-03-19 19:10:06 +03:00
|
|
|
.PHONY: deps-my
|
|
|
|
deps-my:
|
2022-11-30 23:38:47 +03:00
|
|
|
$(NIX_LOCK) $(foreach dep,$(DEPS_MY),--update-input $(dep))
|
|
|
|
|
2023-03-19 19:10:06 +03:00
|
|
|
.PHONY: deps-nixos
|
|
|
|
deps-nixos:
|
2022-11-30 23:38:47 +03:00
|
|
|
$(NIX_LOCK) $(foreach dep,$(DEPS_NIXOS),--update-input $(dep))
|
|
|
|
|
2023-03-19 19:10:06 +03:00
|
|
|
.PHONY: deps-misc
|
|
|
|
deps-misc:
|
2022-11-30 23:38:47 +03:00
|
|
|
$(NIX_LOCK) $(foreach dep,$(DEPS_MISC),--update-input $(dep))
|
|
|
|
|
2024-03-29 18:27:33 +03:00
|
|
|
.PHONY: deps
|
|
|
|
deps: deps-my deps-nixos deps-misc ;
|
|
|
|
|