summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorlassulus <lass@lassul.us>2017-06-27 23:57:26 +0200
committerlassulus <lass@lassul.us>2017-06-27 23:57:26 +0200
commit4986344d6e2674914caa31cb4a4bd198dd3d50a0 (patch)
tree6be70528d3c254a3a00b2c8b12df6feb5541ccdf /Makefile
parentc89cb97a723ee2f93476803ff2de34f872388652 (diff)
parent62e50105badbe23a3e448d8ca9f5770f7698b22b (diff)
Merge remote-tracking branch 'ni/master'
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile29
1 files changed, 17 insertions, 12 deletions
diff --git a/Makefile b/Makefile
index ce6205c5b..cab53d52a 100644
--- a/Makefile
+++ b/Makefile
@@ -51,13 +51,23 @@ $(if $(target_user),,$(error unbound variable: target_user))
$(if $(target_port),,$(error unbound variable: target_port))
$(if $(target_path),,$(error unbound variable: target_path))
+whatsupnix = \
+ if type whatsupnix >/dev/null 2>&1; then \
+ whatsupnix $(1); \
+ else \
+ cat; \
+ fi
+
build = \
nix-build \
+ -Q \
--no-out-link \
--show-trace \
-I nixos-config=$(nixos-config) \
-I stockholm=$(stockholm) \
- -E "with import <stockholm>; $(1)"
+ -E "with import <stockholm>; $(1)" \
+ $(2) \
+ |& $(call whatsupnix)
evaluate = \
nix-instantiate \
@@ -66,7 +76,8 @@ evaluate = \
--show-trace \
-I nixos-config=$(nixos-config) \
-I stockholm=$(stockholm) \
- -E "let eval = import <stockholm>; in with eval; $(1)"
+ -E "let eval = import <stockholm>; in with eval; $(1)" \
+ $(2)
ifeq ($(MAKECMDGOALS),)
$(error No goals specified)
@@ -84,11 +95,7 @@ deploy:
$(ssh) $(target_user)@$(target_host) -p $(target_port) \
env STOCKHOLM_VERSION="$$STOCKHOLM_VERSION" \
nixos-rebuild -Q $(rebuild-command) --show-trace -I $(target_path) \
- |& if type whatsupnix 2>/dev/null; then \
- whatsupnix $(target_user)@$(target_host):$(target_port); \
- else \
- cat; \
- fi
+ |& $(call whatsupnix,$(target_user)@$(target_host):$(target_port))
# usage: make populate system=foo
populate: populate-target = \
@@ -126,10 +133,10 @@ install:
# usage: make test system=foo [target=bar] [method={eval,build}]
method ?= eval
ifeq ($(method),build)
-test: command = nix-build --no-out-link
+test: test = $(call build,$(1),$(2))
else
ifeq ($(method),eval)
-test: command ?= nix-instantiate --eval --json --readonly-mode --strict
+test: test ?= $(call evaluate,$(1),$(2)) --json --strict | jq -r .
else
$(error bad method: $(method))
endif
@@ -141,6 +148,4 @@ else
test: wrapper = $(ssh) $(target_user)@$(target_host) -p $(target_port)
endif
test: populate
- $(wrapper) \
- $(command) --show-trace -I $(target_path) \
- -A config.system.build.toplevel $(target_path)/stockholm
+ $(wrapper) $(call test,config.system.build.toplevel,-I $(target_path))