<commit_before># Global configuration for wvdial.

{ config, pkgs, ... }:

with pkgs.lib;

let

  configFile = ''
    [Dialer Defaults]
    PPPD PATH = ${pkgs.ppp}/sbin/pppd
    ${config.environment.wvdial.dialerDefaults}
  '';

  cfg = config.environment.wvdial;

in
{
  ###### interface

  options = {

    environment.wvdial = {

      dialerDefaults = mkOption {
        default = "";
        type = types.string;
        example = ''Init1 = AT+CGDCONT=1,"IP","internet.t-mobile"'';
        description = ''
          Contents of the "Dialer Defaults" section of
          <filename>/etc/wvdial.conf</filename>.
        '';
      };

      pppDefaults = mkOption {
        default = ''
          noipdefault
          usepeerdns
          defaultroute
          persist
          noauth
        '';
        type = types.string;
        description = "Default ppp settings for wvdial.";
      };

    };

  };

  ###### implementation

  config = mkIf (cfg.dialerDefaults != "") {

    environment = {

      etc =
      [
        { source = pkgs.writeText "wvdial.conf" configFile;
          target = "wvdial.conf";
        }
        { source = pkgs.writeText "wvdial" cfg.pppDefaults;
          target = "ppp/peers/wvdial";
        }
      ];

      systemPackages = [ pkgs.wvdial ];

    };

  };

}<commit_msg>wvdial: don't make wvdial a system package; only root can run it<commit_after># Global configuration for wvdial.

{ config, pkgs, ... }:

with pkgs.lib;

let

  configFile = ''
    [Dialer Defaults]
    PPPD PATH = ${pkgs.ppp}/sbin/pppd
    ${config.environment.wvdial.dialerDefaults}
  '';

  cfg = config.environment.wvdial;

in
{
  ###### interface

  options = {

    environment.wvdial = {

      dialerDefaults = mkOption {
        default = "";
        type = types.string;
        example = ''Init1 = AT+CGDCONT=1,"IP","internet.t-mobile"'';
        description = ''
          Contents of the "Dialer Defaults" section of
          <filename>/etc/wvdial.conf</filename>.
        '';
      };

      pppDefaults = mkOption {
        default = ''
          noipdefault
          usepeerdns
          defaultroute
          persist
          noauth
        '';
        type = types.string;
        description = "Default ppp settings for wvdial.";
      };

    };

  };

  ###### implementation

  config = mkIf (cfg.dialerDefaults != "") {

    environment = {

      etc =
      [
        { source = pkgs.writeText "wvdial.conf" configFile;
          target = "wvdial.conf";
        }
        { source = pkgs.writeText "wvdial" cfg.pppDefaults;
          target = "ppp/peers/wvdial";
        }
      ];

    };

  };

}
{'fraction_non_alphanumeric': 0.13313161875945537, 'fraction_numerical': 0.0015128593040847202, 'mean_word_length': 1.7871443624868282, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3487306', 'n_tokens_mistral': 894, 'n_tokens_neox': 835, 'n_words': 161}