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