summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2017-12-05 23:25:09 +0100
committertv <tv@krebsco.de>2017-12-05 23:30:31 +0100
commit289dd785e5bd5f3a628a7f0282ed4f8638277c5c (patch)
tree59ab504a650fbde6406045f22e0fd2710c4fdbf0 /krebs
parent3fb25717c5c7dbe69f56cea4c529cac398789c2b (diff)
stockholm: export HOSTNAME and STOCKHOLM_VERSION
Diffstat (limited to 'krebs')
-rw-r--r--krebs/5pkgs/simple/stockholm/default.nix14
1 files changed, 14 insertions, 0 deletions
diff --git a/krebs/5pkgs/simple/stockholm/default.nix b/krebs/5pkgs/simple/stockholm/default.nix
index 3d9cea64d..da07c8120 100644
--- a/krebs/5pkgs/simple/stockholm/default.nix
+++ b/krebs/5pkgs/simple/stockholm/default.nix
@@ -207,6 +207,10 @@
'');
init.env = pkgs.writeText "init.env" /* sh */ ''
+
+ export HOSTNAME="$(${pkgs.nettools}/bin/hostname)"
+ export STOCKHOLM_VERSION="''${STOCKHOLM_VERSION-$(${shell.get-version})}"
+
export quiet
export system
export target
@@ -274,6 +278,16 @@
fi
'';
+ shell.get-version = pkgs.writeDash "stockholm.get-version" ''
+ set -efu
+ version=git.$(${pkgs.git}/bin/git describe --always --dirty)
+ case $version in (*-dirty)
+ version=$version@$HOSTNAME
+ esac
+ date=$(${pkgs.coreutils}/bin/date +%y.%m)
+ echo "$date.$version"
+ '';
+
in
pkgs.writeOut "stockholm" (lib.mapAttrs' (name: link: