···
9
-
stateDir = "/var/spool/privoxy";
13
-
privoxyFlags = "--no-daemon --user ${privoxyUser} ${privoxyCfg}";
11
+
cfg = config.services.privoxy;
15
-
privoxyCfg = pkgs.writeText "privoxy.conf" ''
16
-
listen-address ${config.services.privoxy.listenAddress}
17
-
logdir ${config.services.privoxy.logDir}
18
-
confdir ${privoxy}/etc
19
-
filterfile default.filter
21
-
${config.services.privoxy.extraConfig}
13
+
confFile = pkgs.writeText "privoxy.conf" ''
14
+
user-manual ${privoxy}/share/doc/privoxy/user-manual
15
+
confdir ${privoxy}/etc/
16
+
listen-address ${cfg.listenAddress}
17
+
enable-edit-actions ${if (cfg.enableEditActions == true) then "1" else "0"}
18
+
${concatMapStrings (f: "actionsfile ${f}\n") cfg.actionsFiles}
19
+
${concatMapStrings (f: "filterfile ${f}\n") cfg.filterFiles}
···
37
-
Whether to run the machine as a HTTP proxy server.
37
+
Whether to enable the Privoxy non-caching filtering proxy.
listenAddress = mkOption {
default = "127.0.0.1:8118";
Address the proxy server is listening to.
49
-
default = "/var/log/privoxy" ;
49
+
actionsFiles = mkOption {
50
+
type = types.listOf types.str;
51
+
example = [ "match-all.action" "default.action" "/etc/privoxy/user.action" ];
52
+
default = [ "match-all.action" "default.action" ];
51
-
Location for privoxy log files.
54
+
List of paths to Privoxy action files.
55
+
These paths may either be absolute or relative to the privoxy configuration directory.
59
+
filterFiles = mkOption {
60
+
type = types.listOf types.str;
61
+
example = [ "default.filter" "/etc/privoxy/user.filter" ];
62
+
default = [ "default.filter" ];
64
+
List of paths to Privoxy filter files.
65
+
These paths may either be absolute or relative to the privoxy configuration directory.
69
+
enableEditActions = mkOption {
73
+
Whether or not the web-based actions file editor may be used.
Extra configuration. Contents will be added verbatim to the configuration file.
···
68
-
config = mkIf config.services.privoxy.enable {
90
+
config = mkIf cfg.enable {
70
-
environment.systemPackages = [ privoxy ];
users.extraUsers = singleton
uid = config.ids.uids.privoxy;
description = "Privoxy daemon user";
82
-
startOn = "startup";
86
-
mkdir -m 0755 -p ${stateDir}
87
-
chown ${privoxyUser} ${stateDir}
90
-
exec = "${privoxy}/sbin/privoxy ${privoxyFlags}";
98
+
systemd.services.privoxy = {
99
+
description = "Filtering web proxy";
100
+
after = [ "network.target" "nss-lookup.target" ];
101
+
wantedBy = [ "multi-user.target" ];
102
+
serviceConfig.ExecStart = "${privoxy}/sbin/privoxy --no-daemon --user ${privoxyUser} ${confFile}";