Skip to content

Commit

Permalink
Revert "nixos/varnish: change default stateDir to /run"
Browse files Browse the repository at this point in the history
This reverts commit 691e095.

PL-132901
  • Loading branch information
dpausp committed Sep 13, 2024
1 parent 6ce38e4 commit 4c934f9
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions nixos/modules/services/web-servers/varnish/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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.
'';
};

Expand Down Expand Up @@ -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 = {
Expand All @@ -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;
Expand Down

0 comments on commit 4c934f9

Please sign in to comment.