makefile: remove unused commands

This commit is contained in:
Dmitriy Pleshevskiy 2024-03-29 18:27:33 +03:00
parent cbceaebee2
commit 52f409c4ce
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2
2 changed files with 15 additions and 24 deletions

View file

@ -28,32 +28,33 @@ VPS := \
help: help:
bat -p Makefile bat -p Makefile
################################################################################
# Hosts
################################################################################
define machine_rule define machine_rule
.PHONY: $(1) .PHONY: $(1)
$(1): ; $(1): ;
systemctl --user reset-failed systemctl --user reset-failed
sudo $$(NIX_RUN)switch/$(1) sudo $$(NIX_RUN)switch/$(1)
.PHONY: rollback-$(1)
rollback-$(1):
sudo $$(NIX_RUN)rollback/$(1)
.PHONY: test-$(1)
test-$(1): ; sudo $$(NIX_RUN)test/$(1)
endef endef
define vps_rule define vps_rule
.PHONY: $(1) .PHONY: $(1)
$(1): ; $$(NIX_RUN)deploy/$(1) $(1): ; $$(NIX_RUN)deploy/$(1)
.PHONY: rollback-$(1)
rollback-$(1):
$$(NIX_RUN)rollback/$(1)
endef endef
$(foreach machine,$(MACHINES),$(eval $(call machine_rule,$(machine)))) $(foreach machine,$(MACHINES),$(eval $(call machine_rule,$(machine))))
$(foreach vps,$(VPS),$(eval $(call vps_rule,$(vps)))) $(foreach vps,$(VPS),$(eval $(call vps_rule,$(vps))))
.PHONY: rollback
rollback:
sudo nixos-rebuild --rollback
################################################################################
# Deps
################################################################################
.PHONY: deps-my .PHONY: deps-my
deps-my: deps-my:
$(NIX_LOCK) $(foreach dep,$(DEPS_MY),--update-input $(dep)) $(NIX_LOCK) $(foreach dep,$(DEPS_MY),--update-input $(dep))
@ -66,3 +67,6 @@ deps-nixos:
deps-misc: deps-misc:
$(NIX_LOCK) $(foreach dep,$(DEPS_MISC),--update-input $(dep)) $(NIX_LOCK) $(foreach dep,$(DEPS_MISC),--update-input $(dep))
.PHONY: deps
deps: deps-my deps-nixos deps-misc ;

View file

@ -68,24 +68,11 @@
'') '')
vpsMachines); vpsMachines);
rollback = lib.recurseIntoAttrs (lib.mapAttrs
(hostname: machine: pkgs.writeShellScript "rollback-${hostname}" ''
${nixos-rebuild}/bin/nixos-rebuild switch --rollback
'')
self.nixosConfigurations);
switch = lib.recurseIntoAttrs (lib.mapAttrs switch = lib.recurseIntoAttrs (lib.mapAttrs
(hostname: machine: pkgs.writeShellScript "switch-${hostname}" '' (hostname: machine: pkgs.writeShellScript "switch-${hostname}" ''
${nixos-rebuild}/bin/nixos-rebuild switch --flake .#${hostname} $@ ${nixos-rebuild}/bin/nixos-rebuild switch --flake .#${hostname} $@
'') '')
localMachines); localMachines);
test = lib.recurseIntoAttrs (lib.mapAttrs
(hostname: machine: pkgs.writeShellScript "test-${hostname}" ''
${nixos-rebuild}/bin/nixos-rebuild test --flake .#${hostname} $@
'')
localMachines);
}); });
devShells = { devShells = {