squid: 4.17 -> 5.4.1

* enable HTCP
* enable systemd support
* add NixOS option "services.squid.package"
main
Emery Hemingway 2 years ago committed by ehmry
parent b861f07f82
commit ad15abe7ff
  1. 17
      nixos/modules/services/networking/squid.nix
  2. 14
      pkgs/servers/squid/default.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";
};
};

@ -1,20 +1,20 @@
{ lib, stdenv, fetchurl, perl, openldap, pam, db, cyrus_sasl, libcap
, expat, libxml2, openssl, pkg-config
, expat, libxml2, openssl, pkg-config, systemd
}:
stdenv.mkDerivation rec {
pname = "squid";
version = "4.17";
version = "5.4.1";
src = fetchurl {
url = "http://www.squid-cache.org/Versions/v4/${pname}-${version}.tar.xz";
sha256 = "sha256-y5KKwIx8hrFRscj4J6vhqE2DGBoqhuDVEihhY+HjFBg=";
url = "http://www.squid-cache.org/Versions/v5/${pname}-${version}.tar.xz";
sha256 = "sha256-300xCpFmOuWcKbD4GD8iYjxeb3MYaa95OAWYerlMpBw=";
};
nativeBuildInputs = [ pkg-config ];
buildInputs = [
perl openldap db cyrus_sasl expat libxml2 openssl
] ++ lib.optionals stdenv.isLinux [ libcap pam ];
] ++ lib.optionals stdenv.isLinux [ libcap pam systemd ];
configureFlags = [
"--enable-ipv6"
@ -26,7 +26,9 @@ stdenv.mkDerivation rec {
"--enable-removal-policies=lru,heap"
"--enable-delay-pools"
"--enable-x-accelerator-vary"
] ++ lib.optional (stdenv.isLinux && !stdenv.hostPlatform.isMusl) "--enable-linux-netfilter";
"--enable-htcp"
] ++ lib.optional (stdenv.isLinux && !stdenv.hostPlatform.isMusl)
"--enable-linux-netfilter";
meta = with lib; {
description = "A caching proxy for the Web supporting HTTP, HTTPS, FTP, and more";

Loading…
Cancel
Save