29 lines
953 B
Nix
29 lines
953 B
Nix
{ lib, pkgs, cfg, models, backgroundEntries }:
|
|
|
|
pkgs.linkFarm "voip-tftp-root" (
|
|
lib.concatLists (lib.mapAttrsToList (key: phone:
|
|
let m = models.${phone.model}; in
|
|
lib.optional m.hasProvisioning (
|
|
let
|
|
upperKey = lib.toUpper key;
|
|
ext = cfg.extensions.${phone.extension};
|
|
xml = m.template ({
|
|
mac = key;
|
|
inherit (phone) label password;
|
|
displayName = ext.displayName;
|
|
serverAddress = cfg.serverAddress;
|
|
ntpServer = cfg.ntpServer;
|
|
sipPort = cfg.sipPort;
|
|
directoryPort = cfg.directoryPort;
|
|
} // lib.optionalAttrs (cfg.intercomPrefix != null) {
|
|
intercomEnabled = true;
|
|
intercomPassword = phone.password;
|
|
});
|
|
in {
|
|
name = "SEP${upperKey}.cnf.xml";
|
|
path = pkgs.writeText "SEP${upperKey}.cnf.xml" xml;
|
|
}
|
|
)
|
|
) cfg.phones)
|
|
++ backgroundEntries
|
|
)
|