Merge pull request 'zerotier-static-peers: add external devices' (#1698) from kenji/clan-core:zerotier-static/add-external into main
Reviewed-on: https://git.clan.lol/clan/clan-core/pulls/1698
This commit is contained in:
@@ -30,6 +30,16 @@ in
|
|||||||
default = [ config.clan.core.machineName ];
|
default = [ config.clan.core.machineName ];
|
||||||
description = "Hosts that should be excluded";
|
description = "Hosts that should be excluded";
|
||||||
};
|
};
|
||||||
|
networkIps = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
|
description = "Extra zerotier network Ips that should be accepted";
|
||||||
|
};
|
||||||
|
networkIds = lib.mkOption {
|
||||||
|
type = lib.types.listOf lib.types.str;
|
||||||
|
default = [ ];
|
||||||
|
description = "Extra zerotier network Ids that should be accepted";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config.systemd.services.zerotier-static-peers-autoaccept =
|
config.systemd.services.zerotier-static-peers-autoaccept =
|
||||||
@@ -56,6 +66,7 @@ in
|
|||||||
lib.nameValuePair (builtins.readFile fullPath) [ machine ]
|
lib.nameValuePair (builtins.readFile fullPath) [ machine ]
|
||||||
) filteredMachines
|
) filteredMachines
|
||||||
);
|
);
|
||||||
|
allHostIPs = config.clan.zerotier-static-peers.networkIps ++ hosts;
|
||||||
in
|
in
|
||||||
lib.mkIf (config.clan.networking.zerotier.controller.enable) {
|
lib.mkIf (config.clan.networking.zerotier.controller.enable) {
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
@@ -65,7 +76,10 @@ in
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
${lib.concatMapStringsSep "\n" (host: ''
|
${lib.concatMapStringsSep "\n" (host: ''
|
||||||
${config.clan.core.clanPkgs.zerotier-members}/bin/zerotier-members allow --member-ip ${host}
|
${config.clan.core.clanPkgs.zerotier-members}/bin/zerotier-members allow --member-ip ${host}
|
||||||
'') hosts}
|
'') allHostIPs}
|
||||||
|
${lib.concatMapStringsSep "\n" (host: ''
|
||||||
|
${config.clan.core.clanPkgs.zerotier-members}/bin/zerotier-members allow ${host}
|
||||||
|
'') config.clan.zerotier-static-peers.networkIds}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user