diff options
author | tv <tv@krebsco.de> | 2017-07-12 23:22:15 +0200 |
---|---|---|
committer | tv <tv@krebsco.de> | 2017-07-12 23:22:15 +0200 |
commit | 462b019957b99b986d4fd17cb589419bc58cfbfb (patch) | |
tree | ecfc36715945629e582f2f5b7c05460cc133c09c | |
parent | e692f327739ecfbeadd8d8309f2031a5ebec676a (diff) |
Makefile: reimplement {deploy,test} using shell
-rw-r--r-- | Makefile | 37 |
1 files changed, 6 insertions, 31 deletions
@@ -83,19 +83,14 @@ ifeq ($(MAKECMDGOALS),) $(error No goals specified) endif -# usage: make deploy system=foo [target_host=bar] -ifeq ($(debug),true) -deploy: rebuild-command = dry-activate +# usage: make deploy system=foo [target=bar] +# usage: make test system=foo target=bar +deploy test: +ifdef target + nix-shell --run '$@ --system=$(system) --target=$(target)' else -deploy: rebuild-command = switch + nix-shell --run '$@ --system=$(system)' endif -deploy: ssh ?= ssh -deploy: - $(MAKE) populate debug=false - $(ssh) $(target_user)@$(target_host) -p $(target_port) \ - env STOCKHOLM_VERSION="$$STOCKHOLM_VERSION" \ - nixos-rebuild -Q $(rebuild-command) --show-trace -I $(target_path) \ - |& $(call whatsupnix,$(target_user)@$(target_host):$(target_port)) # usage: make populate system=foo populate: populate-target = \ @@ -129,23 +124,3 @@ install: env NIXOS_CONFIG=$(target_path)/nixos-config \ STOCKHOLM_VERSION="$$STOCKHOLM_VERSION" \ nixos-install - -# usage: make test system=foo [target=bar] [method={eval,build}] -method ?= eval -ifeq ($(method),build) -test: test = $(call build,$(1),$(2)) -else -ifeq ($(method),eval) -test: test ?= $(call evaluate,$(1),$(2)) --json --strict | jq -r . -else -$(error bad method: $(method)) -endif -endif -test: ssh ?= ssh -ifeq ($(target_user)@$(target_host),$(LOGNAME)@$(HOSTNAME)) -test: wrapper = exec -else -test: wrapper = $(ssh) $(target_user)@$(target_host) -p $(target_port) -endif -test: populate - $(wrapper) $(call test,config.system.build.toplevel,-I $(target_path)) |