From e8505f71ff4741156fc3ce05542dd3aa70798214 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 12 Jul 2018 14:14:27 +0200 Subject: lib: add isLocalTarget --- lib/default.nix | 6 ++++++ pkgs/krops/default.nix | 8 +------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/default.nix b/lib/default.nix index 7197fe9..ae1cef9 100644 --- a/lib/default.nix +++ b/lib/default.nix @@ -34,6 +34,12 @@ let { if lib.length y != 1 then throw "malformed /etc/hostname" else lib.elemAt y 0; + isLocalTarget = let + origin = lib.mkTarget ""; + in target: + target.user == origin.user && + lib.elem target.host [origin.host "localhost"]; + mkTarget = s: let default = defVal: val: if val != null then val else defVal; parse = lib.match "(([^@]+)@)?(([^:/]+))?(:([^/]+))?(/.*)?" s; diff --git a/pkgs/krops/default.nix b/pkgs/krops/default.nix index 496b8d3..d9bea4b 100644 --- a/pkgs/krops/default.nix +++ b/pkgs/krops/default.nix @@ -1,11 +1,5 @@ let - lib = import ../../lib // { - isLocalTarget = let - origin = lib.mkTarget ""; - in target: - target.host == origin.host && - target.user == origin.user; - }; + lib = import ../../lib; in { nix, openssh, populate, writeDash, writeJSON }: let -- cgit v1.2.3