diff --git a/Makefile b/Makefile index 19bb993..dc67098 100644 --- a/Makefile +++ b/Makefile @@ -28,32 +28,33 @@ VPS := \ help: bat -p Makefile +################################################################################ +# Hosts +################################################################################ + define machine_rule .PHONY: $(1) $(1): ; systemctl --user reset-failed 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 define vps_rule .PHONY: $(1) $(1): ; $$(NIX_RUN)deploy/$(1) - -.PHONY: rollback-$(1) -rollback-$(1): - $$(NIX_RUN)rollback/$(1) 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)) @@ -66,3 +67,6 @@ deps-nixos: deps-misc: $(NIX_LOCK) $(foreach dep,$(DEPS_MISC),--update-input $(dep)) +.PHONY: deps +deps: deps-my deps-nixos deps-misc ; + diff --git a/flake.nix b/flake.nix index d14269c..a5d33b9 100644 --- a/flake.nix +++ b/flake.nix @@ -68,24 +68,11 @@ '') 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 (hostname: machine: pkgs.writeShellScript "switch-${hostname}" '' ${nixos-rebuild}/bin/nixos-rebuild switch --flake .#${hostname} $@ '') localMachines); - - test = lib.recurseIntoAttrs (lib.mapAttrs - (hostname: machine: pkgs.writeShellScript "test-${hostname}" '' - ${nixos-rebuild}/bin/nixos-rebuild test --flake .#${hostname} $@ - '') - localMachines); - }); devShells = {