about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorEmery Hemingway <ehmry@c3d2.de>2022-03-03 11:14:03 -0600
committerehmry <ehmry@posteo.net>2022-03-25 15:59:05 +0000
commitad15abe7ffbc68ba8a41fdb9270c31b75e2e7fd8 (patch)
tree8969291414446c0bbc619f4ae70302e66016bfd5 /nixos/modules
parentb861f07f8203abd3702281eda6fb7f264200fc49 (diff)
downloadnixlib-ad15abe7ffbc68ba8a41fdb9270c31b75e2e7fd8.tar
nixlib-ad15abe7ffbc68ba8a41fdb9270c31b75e2e7fd8.tar.gz
nixlib-ad15abe7ffbc68ba8a41fdb9270c31b75e2e7fd8.tar.bz2
nixlib-ad15abe7ffbc68ba8a41fdb9270c31b75e2e7fd8.tar.lz
nixlib-ad15abe7ffbc68ba8a41fdb9270c31b75e2e7fd8.tar.xz
nixlib-ad15abe7ffbc68ba8a41fdb9270c31b75e2e7fd8.tar.zst
nixlib-ad15abe7ffbc68ba8a41fdb9270c31b75e2e7fd8.zip
squid: 4.17 -> 5.4.1
* enable HTCP
* enable systemd support
* add NixOS option "services.squid.package"
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/services/networking/squid.nix17
1 files changed, 14 insertions, 3 deletions
diff --git a/nixos/modules/services/networking/squid.nix b/nixos/modules/services/networking/squid.nix
index 4f3881af8bbf..db4f0d26b6f4 100644
--- a/nixos/modules/services/networking/squid.nix
+++ b/nixos/modules/services/networking/squid.nix
@@ -111,6 +111,13 @@ in
         description = "Whether to run squid web proxy.";
       };
 
+      package = mkOption {
+        default = pkgs.squid;
+        defaultText = literalExpression "pkgs.squid";
+        type = types.package;
+        description = "Squid package to use.";
+      };
+
       proxyAddress = mkOption {
         type = types.nullOr types.str;
         default = null;
@@ -157,17 +164,21 @@ in
     users.groups.squid = {};
 
     systemd.services.squid = {
-      description = "Squid caching web proxy";
+      description = "Squid caching proxy";
+      documentation = [ "man:squid(8)" ];
       after = [ "network.target" "nss-lookup.target" ];
       wantedBy = [ "multi-user.target"];
       preStart = ''
         mkdir -p "/var/log/squid"
         chown squid:squid "/var/log/squid"
+        ${cfg.package}/bin/squid --foreground -z -f ${squidConfig}
       '';
       serviceConfig = {
-        Type="forking";
         PIDFile="/run/squid.pid";
-        ExecStart  = "${pkgs.squid}/bin/squid -YCs -f ${squidConfig}";
+        ExecStart  = "${cfg.package}/bin/squid --foreground -YCs -f ${squidConfig}";
+        ExecReload="kill -HUP $MAINPID";
+        KillMode="mixed";
+        NotifyAccess="all";
       };
     };