12 cfg = config.services.polipo;
14 polipoConfig = pkgs.writeText "polipo.conf" ''
15 proxyAddress = ${cfg.proxyAddress}
16 proxyPort = ${toString cfg.proxyPort}
17 allowedClients = ${concatStringsSep ", " cfg.allowedClients}
18 ${optionalString (cfg.parentProxy != "") "parentProxy = ${cfg.parentProxy}"}
19 ${optionalString (cfg.socksParentProxy != "") "socksParentProxy = ${cfg.socksParentProxy}"}
20 ${config.services.polipo.extraConfig}
31 enable = mkEnableOption "polipo caching web proxy";
33 proxyAddress = mkOption {
35 default = "127.0.0.1";
36 description = "IP address on which Polipo will listen.";
39 proxyPort = mkOption {
42 description = "TCP port on which Polipo will listen.";
45 allowedClients = mkOption {
46 type = types.listOf types.str;
58 List of IP addresses or network addresses that may connect to Polipo.
62 parentProxy = mkOption {
65 example = "localhost:8124";
67 Hostname and port number of an HTTP parent proxy;
68 it should have the form ‘host:port’.
72 socksParentProxy = mkOption {
75 example = "localhost:9050";
77 Hostname and port number of an SOCKS parent proxy;
78 it should have the form ‘host:port’.
82 extraConfig = mkOption {
86 Polio configuration. Contents will be added
87 verbatim to the configuration file.
95 config = mkIf cfg.enable {
97 users.users.polipo = {
98 uid = config.ids.uids.polipo;
99 description = "Polipo caching proxy user";
100 home = "/var/cache/polipo";
104 users.groups.polipo = {
105 gid = config.ids.gids.polipo;
106 members = [ "polipo" ];
109 systemd.services.polipo = {
110 description = "caching web proxy";
115 wantedBy = [ "multi-user.target" ];
117 ExecStart = "${pkgs.polipo}/bin/polipo -c ${polipoConfig}";