summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2020-06-08 22:58:11 +0200
committertv <tv@krebsco.de>2020-06-08 22:59:42 +0200
commit81c4885124f8a6c316a9911a0cb4bd60caa4e674 (patch)
treec1ec1771d0a6932e312d82d15492ac9ecbab23d8 /lib
parent67132ed53f41c78377306c782e06590cbde91982 (diff)
lib: add firstWord
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/default.nix b/lib/default.nix
index 5829250..f1f0007 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -36,6 +36,9 @@ let {
if lib.length y != 1 then throw "malformed /etc/hostname" else
lib.elemAt y 0;
+ firstWord = s:
+ lib.head (lib.match "^([^[:space:]]*).*" s);
+
isLocalTarget = let
origin = lib.mkTarget "";
in target: