move zerotier secret generation into nixos module

This commit is contained in:
Jörg Thalheim
2023-09-26 17:31:45 +02:00
parent 079d727a2c
commit 6e1a5ad81f

View File

@@ -45,8 +45,8 @@ in
{ {
options.clan.networking.zerotier = { options.clan.networking.zerotier = {
networkId = lib.mkOption { networkId = lib.mkOption {
type = lib.types.str; type = lib.nullOr lib.types.str;
default = config.clanCore.secrets.zerotier.facts."zerotier-network-id".value; default = null;
description = '' description = ''
zerotier networking id zerotier networking id
''; '';
@@ -87,6 +87,7 @@ in
}; };
}) })
(lib.mkIf cfg.controller.enable { (lib.mkIf cfg.controller.enable {
clan.networking.zerotier.networkId = lib.mkDefault config.clanCore.secrets.zerotier.facts."zerotier-network-id".value;
# only the controller needs to have the key in the repo, the other clients can be dynamic # only the controller needs to have the key in the repo, the other clients can be dynamic
# we generate the zerotier code manually for the controller, since it's part of the bootstrap command # we generate the zerotier code manually for the controller, since it's part of the bootstrap command
clanCore.secrets.zerotier = { clanCore.secrets.zerotier = {