1 { config, lib, pkgs, ... }:
7 cfg = config.services.polipo;
9 polipoConfig = pkgs.writeText "polipo.conf" ''
10 proxyAddress = ${cfg.proxyAddress}
11 proxyPort = ${toString cfg.proxyPort}
12 allowedClients = ${concatStringsSep ", " cfg.allowedClients}
13 ${optionalString (cfg.parentProxy != "") "parentProxy = ${cfg.parentProxy}" }
14 ${optionalString (cfg.socksParentProxy != "") "socksParentProxy = ${cfg.socksParentProxy}" }
15 ${config.services.polipo.extraConfig}
26 enable = mkEnableOption "polipo caching web proxy";
28 proxyAddress = mkOption {
30 default = "127.0.0.1";
31 description = "IP address on which Polipo will listen.";
34 proxyPort = mkOption {
37 description = "TCP port on which Polipo will listen.";
40 allowedClients = mkOption {
41 type = types.listOf types.str;
42 default = [ "127.0.0.1" "::1" ];
43 example = [ "127.0.0.1" "::1" "134.157.168.0/24" "2001:660:116::/48" ];
45 List of IP addresses or network addresses that may connect to Polipo.
49 parentProxy = mkOption {
52 example = "localhost:8124";
54 Hostname and port number of an HTTP parent proxy;
55 it should have the form ‘host:port’.
59 socksParentProxy = mkOption {
62 example = "localhost:9050";
64 Hostname and port number of an SOCKS parent proxy;
65 it should have the form ‘host:port’.
69 extraConfig = mkOption {
73 Polio configuration. Contents will be added
74 verbatim to the configuration file.
82 config = mkIf cfg.enable {
85 { uid = config.ids.uids.polipo;
86 description = "Polipo caching proxy user";
87 home = "/var/cache/polipo";
92 { gid = config.ids.gids.polipo;
93 members = [ "polipo" ];
96 systemd.services.polipo = {
97 description = "caching web proxy";
98 after = [ "network.target" "nss-lookup.target" ];
99 wantedBy = [ "multi-user.target"];
101 ExecStart = "${pkgs.polipo}/bin/polipo -c ${polipoConfig}";