lib: add isLocalTarget

This commit is contained in:
tv 2018-07-12 14:14:27 +02:00
parent 9677846bf5
commit e8505f71ff
2 changed files with 7 additions and 7 deletions

View File

@ -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;

View File

@ -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