From 65e87f8f4b72a699ba257548b9cc195b40f25d05 Mon Sep 17 00:00:00 2001 From: Tobias Stenzel Date: Fri, 13 Sep 2024 10:02:11 +0200 Subject: [PATCH] Revert "nixos/varnish: change default stateDir to /run" This reverts commit 691e09524a7c798040225c6c93812e1fa6ceabfa. PL-132901 --- .../modules/services/web-servers/varnish/default.nix | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/nixos/modules/services/web-servers/varnish/default.nix b/nixos/modules/services/web-servers/varnish/default.nix index 5ba54f5a38656..b8e7532b2e0a9 100644 --- a/nixos/modules/services/web-servers/varnish/default.nix +++ b/nixos/modules/services/web-servers/varnish/default.nix @@ -34,10 +34,10 @@ in stateDir = mkOption { type = types.path; - default = "/run/varnish/${config.networking.hostName}"; - defaultText = literalExpression ''"/run/varnish/''${config.networking.hostName}"''; + default = "/var/spool/varnish/${config.networking.hostName}"; + defaultText = literalExpression ''"/var/spool/varnish/''${config.networking.hostName}"''; description = '' - Directory holding all state for Varnish to run. Note that this should be a tmpfs in order to avoid performance issues and crashes. + Directory holding all state for Varnish to run. ''; }; @@ -68,11 +68,11 @@ in description = "Varnish"; wantedBy = [ "multi-user.target" ]; after = [ "network.target" ]; - preStart = mkIf (!(lib.hasPrefix "/run/" cfg.stateDir)) '' + preStart = '' mkdir -p ${cfg.stateDir} chown -R varnish:varnish ${cfg.stateDir} ''; - postStop = mkIf (!(lib.hasPrefix "/run/" cfg.stateDir)) '' + postStop = '' rm -rf ${cfg.stateDir} ''; serviceConfig = { @@ -83,7 +83,6 @@ in RestartSec = "5s"; User = "varnish"; Group = "varnish"; - RuntimeDirectory = mkIf (lib.hasPrefix "/run/" cfg.stateDir) (lib.removePrefix "/run/" cfg.stateDir); AmbientCapabilities = "cap_net_bind_service"; NoNewPrivileges = true; LimitNOFILE = 131072;