···125125- `amdgpu` kernel driver overdrive mode can now be enabled by setting [hardware.amdgpu.overdrive.enable](#opt-hardware.amdgpu.overdrive.enable) and customized through [hardware.amdgpu.overdrive.ppfeaturemask](#opt-hardware.amdgpu.overdrive.ppfeaturemask).126126 This allows for fine-grained control over the GPU's performance and maybe required by overclocking softwares like Corectrl and Lact. These new options replace old options such as {option}`programs.corectrl.gpuOverclock.enable` and {option}`programs.tuxclocker.enableAMD`.127127128128+- `services.varnish.http_address` has been superseeded by `services.varnish.listen` which is now129129+ structured config for all of varnish's `-a` variations.130130+128131- [](#opt-services.gnome.gnome-keyring.enable) does not ship with an SSH agent anymore, as this is now handled by the `gcr_4` package instead of `gnome-keyring`. A new module has been added to support this, under [](#opt-services.gnome.gcr-ssh-agent.enable) (its default value has been set to [](#opt-services.gnome.gnome-keyring.enable) to ensure a smooth transition). See the [relevant upstream PR](https://gitlab.gnome.org/GNOME/gcr/-/merge_requests/67) for more details.129132130133- The `nettools` package (ifconfig, arp, mii-tool, netstat, route) is not installed by default anymore. The suite is unmaintained and users should migrate to `iproute2` and `ethtool` instead.
···66}:7788let99+ inherit (lib)1010+ types1111+ mkOption1212+ hasPrefix1313+ concatMapStringsSep1414+ optionalString1515+ concatMap1616+ ;1717+ inherit (builtins) isNull;1818+919 cfg = config.services.varnish;10201121 # Varnish has very strong opinions and very complicated code around handling···3626 else3727 "/var/run/varnishd";38282929+ # from --help:3030+ # -a [<name>=]address[:port][,proto] # HTTP listen address and port3131+ # [,user=<u>][,group=<g>] # Can be specified multiple times.3232+ # [,mode=<m>] # default: ":80,HTTP"3333+ # # Proto can be "PROXY" or "HTTP" (default)3434+ # # user, group and mode set permissions for3535+ # # a Unix domain socket.3636+ commandLineAddresses =3737+ (concatMapStringsSep " " (3838+ a:3939+ "-a "4040+ + optionalString (!isNull a.name) "${a.name}="4141+ + a.address4242+ + optionalString (!isNull a.port) ":${toString a.port}"4343+ + optionalString (!isNull a.proto) ",${a.proto}"4444+ + optionalString (!isNull a.user) ",user=${a.user}"4545+ + optionalString (!isNull a.group) ",group=${a.group}"4646+ + optionalString (!isNull a.mode) ",mode=${a.mode}"4747+ ) cfg.listen)4848+ + lib.optionalString (!isNull cfg.http_address) " -a ${cfg.http_address}";4949+ addressSubmodule = types.submodule {5050+ options = {5151+ name = mkOption {5252+ description = "Name is referenced in logs. If name is not specified, 'a0', 'a1', etc. is used.";5353+ default = null;5454+ type = with types; nullOr str;5555+ };5656+ address = mkOption {5757+ description = ''5858+ If given an IP address, it can be a host name ("localhost"), an IPv4 dotted-quad5959+ ("127.0.0.1") or an IPv6 address enclosed in square brackets ("[::1]").6060+6161+ (VCL4.1 and higher) If given an absolute Path ("/path/to/listen.sock") or "@"6262+ followed by the name of an abstract socket ("@myvarnishd") accept connections6363+ on a Unix domain socket.6464+6565+ The user, group and mode sub-arguments may be used to specify the permissions6666+ of the socket file. These sub-arguments do not apply to abstract sockets.6767+ '';6868+ type = types.str;6969+ };7070+ port = mkOption {7171+ description = "The port to use for IP sockets. If port is not specified, port 80 (http) is used.";7272+ default = null;7373+ type = with types; nullOr int;7474+ };7575+ proto = mkOption {7676+ description = "PROTO can be 'HTTP' (the default) or 'PROXY'. Both version 1 and 2 of the proxy protocol can be used.";7777+ type = types.enum [7878+ "HTTP"7979+ "PROXY"8080+ ];8181+ default = "HTTP";8282+ };8383+ user = mkOption {8484+ description = "User name who owns the socket file.";8585+ default = null;8686+ type = with lib.types; nullOr str;8787+ };8888+ group = mkOption {8989+ description = "Group name who owns the socket file.";9090+ default = null;9191+ type = with lib.types; nullOr str;9292+ };9393+ mode = mkOption {9494+ description = "Permission of the socket file (3-digit octal value).";9595+ default = null;9696+ type = with types; nullOr str;9797+ };9898+ };9999+ };100100+ checkedAddressModule = types.addCheck addressSubmodule (101101+ m:102102+ (103103+ if ((hasPrefix "@" m.address) || (hasPrefix "/" m.address)) then104104+ # this is a unix socket105105+ (m.port != null)106106+ else107107+ # this is not a path-based unix socket108108+ if !(hasPrefix "/" m.address) && (m.group != null) || (m.user != null) || (m.mode != null) then109109+ false110110+ else111111+ true112112+ )113113+ );39114 commandLine =40115 "-f ${pkgs.writeText "default.vcl" cfg.config}"41116 +···14954 package = lib.mkPackageOption pkgs "varnish" { };1505515156 http_address = lib.mkOption {152152- type = lib.types.str;153153- default = "*:6081";5757+ type = with lib.types; nullOr str;5858+ default = null;15459 description = ''15560 HTTP listen address and port.15661 '';6262+ };6363+6464+ listen = lib.mkOption {6565+ description = "Accept for client requests on the specified listen addresses.";6666+ type = lib.types.listOf checkedAddressModule;6767+ defaultText = lib.literalExpression ''[ { address="*"; port=6081; } ]'';6868+ default = lib.optional (isNull cfg.http_address) {6969+ address = "*";7070+ port = 6081;7171+ };15772 };1587315974 config = lib.mkOption {···20297 serviceConfig = {20398 Type = "simple";20499 PermissionsStartOnly = true;205205- ExecStart = "${cfg.package}/sbin/varnishd -a ${cfg.http_address} -n ${stateDir} -F ${cfg.extraCommandLine} ${commandLine}";100100+ ExecStart = "${cfg.package}/sbin/varnishd ${commandLineAddresses} -n ${stateDir} -F ${cfg.extraCommandLine} ${commandLine}";206101 Restart = "always";207102 RestartSec = "5s";208103 User = "varnish";···222117 ${cfg.package}/bin/varnishd -C ${commandLine} 2> $out || (cat $out; exit 1)223118 '')224119 ];120120+121121+ assertions = concatMap (m: [122122+ {123123+ assertion = (hasPrefix "/" m.address) || (hasPrefix "@" m.address) -> m.port == null;124124+ message = "Listen ports must not be specified with UNIX sockets: ${builtins.toJSON m}";125125+ }126126+ {127127+ assertion = !(hasPrefix "/" m.address) -> m.user == null && m.group == null && m.mode == null;128128+ message = "Abstract UNIX sockets or IP sockets can not be used with user, group, and mode settings: ${builtins.toJSON m}";129129+ }130130+ ]) cfg.listen;131131+132132+ warnings =133133+ lib.optional (!isNull cfg.http_address)134134+ "The option `services.varnish.http_address` is deprecated. Use `services.varnish.listen` instead.";225135226136 users.users.varnish = {227137 group = "varnish";