1# Global configuration for wvdial.
2
3{
4 config,
5 lib,
6 pkgs,
7 ...
8}:
9
10let
11 cfg = config.environment.wvdial;
12in
13{
14 options = {
15 environment.wvdial = {
16 dialerDefaults = lib.mkOption {
17 default = "";
18 type = lib.types.str;
19 example = ''Init1 = AT+CGDCONT=1,"IP","internet.t-mobile"'';
20 description = ''
21 Contents of the "Dialer Defaults" section of
22 <filename>/etc/wvdial.conf</filename>.
23 '';
24 };
25 pppDefaults = lib.mkOption {
26 default = ''
27 noipdefault
28 usepeerdns
29 defaultroute
30 persist
31 noauth
32 '';
33 type = lib.types.str;
34 description = "Default ppp settings for wvdial.";
35 };
36 };
37 };
38
39 config = lib.mkIf (cfg.dialerDefaults != "") {
40 environment.etc."wvdial.conf".source = pkgs.writeText "wvdial.conf" ''
41 [Dialer Defaults]
42 PPPD PATH = ${pkgs.ppp}/sbin/pppd
43 ${config.environment.wvdial.dialerDefaults}
44 '';
45 environment.etc."ppp/peers/wvdial".source = pkgs.writeText "wvdial" cfg.pppDefaults;
46 };
47}