mirror of
https://cgit.krebsco.de/krops
synced 2024-11-23 03:29:48 +01:00
lib: add isLocalTarget
This commit is contained in:
parent
9677846bf5
commit
e8505f71ff
2 changed files with 7 additions and 7 deletions
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue