summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2016-03-05 12:40:20 +0100
committertv <tv@krebsco.de>2016-03-05 12:40:20 +0100
commit54129c440e467160b4b7339d20a9380fa48a017e (patch)
tree5970ee84816c6c71fffcafa4e145b1a0d06f1569 /Makefile
parent89f731a8986d00ec850e4ebebd90259bda12f24a (diff)
krebs os-release: init
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile11
1 files changed, 10 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 12a60a90..226c0f29 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,12 @@
stockholm ?= .
+export STOCKHOLM_VERSION ?= $(shell \
+ version=git.$$(git describe --always --dirty); \
+ case $$version in (*-dirty) version=$$version@$$(hostname); esac; \
+ date=$$(date +%y.%m); \
+ printf '%s' "$$date.$$version"; \
+)
+
ifndef nixos-config
$(if $(system),,$(error unbound variable: system))
nixos-config = ./$(LOGNAME)/1systems/$(system).nix
@@ -60,7 +67,8 @@ deploy: ssh ?= ssh
deploy:
$(call execute,populate)
$(ssh) $(target_user)@$(target_host) -p $(target_port) \
- nixos-rebuild switch --show-trace -I $(target_path)
+ env STOCKHOLM_VERSION="$$STOCKHOLM_VERSION" \
+ nixos-rebuild switch --show-trace -I $(target_path)
# usage: make LOGNAME=shared system=wolf eval.config.krebs.build.host.name
eval eval.:;@$(call evaluate,$${expr-eval})
@@ -75,6 +83,7 @@ install:
target_path=/mnt$(target_path) $(call execute,populate)
$(ssh) $(target_user)@$(target_host) -p $(target_port) \
env NIXOS_CONFIG=$(target_path)/nixos-config \
+ STOCKHOLM_VERSION="$$STOCKHOLM_VERSION" \
nixos-install
# usage: make test system=foo [target=bar] [method={eval,build}]