nix: fix rollback command

This commit is contained in:
Dmitriy Pleshevskiy 2023-03-31 15:17:40 +03:00
parent 8c7fb4159d
commit 6ed972043e
Signed by: pleshevskiy
GPG key ID: 79C4487B44403985
2 changed files with 11 additions and 5 deletions

View file

@ -37,13 +37,21 @@ $(1): ;
systemctl --user reset-failed
$$(NIX_RUN)switch/$(1)
.PHONY: $(1)-test
$(1)-test: ; $$(NIX_RUN)test/$(1)
.PHONY: rollback-$(1)
rollback-$(1):
$$(NIX_RUN)rollback/$(1)
.PHONY: test-$(1)
test-$(1): ; $$(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))))

View file

@ -74,9 +74,7 @@
rollback = lib.recurseIntoAttrs (lib.mapAttrs
(hostname: machine: pkgs.writeShellScript "rollback-${hostname}" ''
${nixos-rebuild}/bin/nixos-rebuild test \
--rollback \
--flake .#${hostname}
${nixos-rebuild}/bin/nixos-rebuild switch --rollback
'')
self.nixosConfigurations);