16 lines
566 B
Nix
16 lines
566 B
Nix
{ lib, cfg, models, allPhones }:
|
|
|
|
if cfg.intercomPrefix == null then []
|
|
else lib.concatLists (lib.mapAttrsToList (key: phone:
|
|
let m = models.${phone.model}; in
|
|
lib.optional m.hasProvisioning {
|
|
extension = "${cfg.intercomPrefix}${phone.extension}";
|
|
endpoint = "${key}-intercom";
|
|
phoneKey = key;
|
|
target = phone.extension;
|
|
displayName = "Intercom ${phone.displayName}";
|
|
password = phone.password;
|
|
endpointTemplate = m.endpointTemplate;
|
|
maxContacts = m.maxContacts;
|
|
}
|
|
) allPhones)
|