diff options
author | makefu <github@syntax-fehler.de> | 2016-02-04 12:01:14 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2016-02-04 12:01:14 +0100 |
commit | 4ab103ba475b0add519054772f2ff3b542184466 (patch) | |
tree | 17f0005251a2d11e8fe67325453f63707491ecc6 | |
parent | e89f43de944af3751b7a70de87e3cc0c1860f2bd (diff) | |
parent | 07a1e29b32f1c507380a252092ff85b1e69dec08 (diff) |
Merge remote-tracking branch 'cd/master'
-rw-r--r-- | Makefile | 40 | ||||
-rw-r--r-- | default.nix | 5 |
2 files changed, 18 insertions, 27 deletions
@@ -9,34 +9,24 @@ export target_host ?= $(system) export target_user ?= root export target_path ?= /var/src +evaluate = \ + nix-instantiate \ + --arg configuration "./$$LOGNAME/1systems/$$system.nix" \ + --eval \ + --readonly-mode \ + --show-trace \ + $(1) + +execute = $(call evaluate,-A config.krebs.build.$(1) --json) | jq -r . | sh + # usage: make deploy system=foo [target_host=bar] -.PHONY: deploy -deploy: populate ;@set -x +deploy: + $(call execute,populate) ssh "$$target_user@$$target_host" nixos-rebuild switch -I "$$target_path" -# usage: make populate system=foo [target_host=bar] -.PHONY: populate -populate:;@ - result=$$(make -s eval get=config.krebs.build.populate filter=json) - echo "$$result" | sh - -# usage: make eval system=foo get=config.krebs.build [LOGNAME=tv] [filter=json] -.PHONY: eval -eval:;@ -ifeq ($(filter),json) - extraArgs='--json --strict' - filter() { echo "$$1" | jq -r .; } -else - filter() { echo "$$1"; } -endif - result=$$(nix-instantiate \ - $${extraArgs-} \ - --show-trace \ - --readonly-mode \ - --eval \ - -A "$$get" \ - --arg configuration "./$$LOGNAME/1systems/$$system.nix") - filter "$$result" +# usage: make LOGNAME=shared system=wolf eval.config.krebs.build.host.name +eval eval.:;@$(call evaluate) +eval.%:;@$(call evaluate,-A $*) ## usage: make install system=foo target= #.PHONY: install diff --git a/default.nix b/default.nix index 278f1d14d..b0ad60d8a 100644 --- a/default.nix +++ b/default.nix @@ -27,9 +27,10 @@ let stockholm = { nlib = import (slib.npath "lib"); klib = import (slib.kpath "4lib") { lib = nlib; }; slib = rec { + nspath = ns: p: ./. + "/${ns}/${p}"; npath = p: nixpkgs-path + "/${p}"; - kpath = p: ./. + "/krebs/${p}"; - upath = p: ./. + "/${current-user-name}/${p}"; + kpath = nspath "krebs"; + upath = nspath current-user-name; }; ulib = let p = slib.upath "4lib"; in nlib.optionalAttrs (klib.dir.has-default-nix p) |