diff options
-rw-r--r-- | Makefile | 20 |
1 files changed, 13 insertions, 7 deletions
@@ -41,17 +41,17 @@ target_path ?= $(_target_path) endif endif -export target_host ?= $(system) -export target_user ?= root -export target_port ?= 22 -export target_path ?= /var/src +target_host ?= $(system) +target_user ?= root +target_port ?= 22 +target_path ?= /var/src $(if $(target_host),,$(error unbound variable: target_host)) $(if $(target_user),,$(error unbound variable: target_user)) $(if $(target_port),,$(error unbound variable: target_port)) $(if $(target_path),,$(error unbound variable: target_path)) -export target ?= $(target_user)@$(target_host):$(target_port)$(target_path) +target ?= $(target_user)@$(target_host):$(target_port)$(target_path) build = \ nix-build \ @@ -75,11 +75,17 @@ $(error No goals specified) endif # usage: make deploy system=foo [target_host=bar] +ifeq ($(debug),true) +deploy: rebuild-command = dry-activate +else +deploy: rebuild-command = switch +endif deploy: ssh ?= ssh -deploy: populate +deploy: + $(MAKE) populate debug=false $(ssh) $(target_user)@$(target_host) -p $(target_port) \ env STOCKHOLM_VERSION="$$STOCKHOLM_VERSION" \ - nixos-rebuild switch --show-trace -I $(target_path) + nixos-rebuild $(rebuild-command) --show-trace -I $(target_path) # usage: make populate system=foo ifeq ($(debug),true) |