72 lines
1.3 KiB
Makefile
72 lines
1.3 KiB
Makefile
NIX_RUN := nix run .\#
|
|
NIX_LOCK := nix flake lock
|
|
|
|
DEPS_MY := \
|
|
myneovim
|
|
|
|
DEPS_NIXOS := \
|
|
nixpkgs \
|
|
nixpkgs-unstable \
|
|
hardware \
|
|
home-manager \
|
|
agenix
|
|
|
|
DEPS_MISC := \
|
|
wired \
|
|
nil
|
|
|
|
MACHINES := \
|
|
home \
|
|
asus-gl553vd
|
|
|
|
VPS := \
|
|
istal \
|
|
tatos
|
|
|
|
.PHONY: help
|
|
help:
|
|
bat -p Makefile
|
|
|
|
################################################################################
|
|
# Hosts
|
|
################################################################################
|
|
|
|
define machine_rule
|
|
.PHONY: $(1)
|
|
$(1): ;
|
|
systemctl --user reset-failed
|
|
sudo nix run $(NIX_ARGS) .#switch/$(1) -- $(BUILD_ARGS)
|
|
endef
|
|
|
|
define vps_rule
|
|
.PHONY: $(1)
|
|
$(1): ; nix run .#deploy/$(1) -- $(BUILD_ARGS)
|
|
|
|
endef
|
|
|
|
$(foreach machine,$(MACHINES),$(eval $(call machine_rule,$(machine))))
|
|
$(foreach vps,$(VPS),$(eval $(call vps_rule,$(vps))))
|
|
|
|
.PHONY: rollback
|
|
rollback:
|
|
sudo nixos-rebuild --rollback
|
|
|
|
################################################################################
|
|
# Deps
|
|
################################################################################
|
|
|
|
.PHONY: deps-my
|
|
deps-my:
|
|
$(NIX_LOCK) $(foreach dep,$(DEPS_MY),--update-input $(dep))
|
|
|
|
.PHONY: deps-nixos
|
|
deps-nixos:
|
|
$(NIX_LOCK) $(foreach dep,$(DEPS_NIXOS),--update-input $(dep))
|
|
|
|
.PHONY: deps-misc
|
|
deps-misc:
|
|
$(NIX_LOCK) $(foreach dep,$(DEPS_MISC),--update-input $(dep))
|
|
|
|
.PHONY: deps
|
|
deps: deps-my deps-nixos deps-misc ;
|
|
|