ma lancache: retab

This commit is contained in:
makefu 2017-07-01 01:10:31 +02:00
parent 7cd2ff2679
commit 09e31fb8a2
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225

View File

@ -36,38 +36,39 @@ let
}; };
in { in {
systemd.services.nginx-lancache = { systemd.services.nginx-lancache = {
description = "Nginx lancache Server"; description = "Nginx lancache Server";
after = [ "network.target" ]; after = [ "network.target" ];
wantedBy = [ "multi-user.target" ]; wantedBy = [ "multi-user.target" ];
restartIfChanged = true; restartIfChanged = true;
preStart = '' preStart = ''
mkdir -p ${cfg.statedir} && cd ${cfg.statedir} mkdir -p ${cfg.statedir} && cd ${cfg.statedir}
PATH_CACHE=$PATH_BASE/cache PATH_CACHE=$PATH_BASE/cache
PATH_LOGS=$PATH_BASE/logs PATH_LOGS=$PATH_BASE/logs
mkdir -p cache/{installers,tmp} logs mkdir -p cache/{installers,tmp} logs
rm -f conf; ln -s ${lancache} conf rm -f conf; ln -s ${lancache} conf
chown -R ${cfg.user}:${cfg.group} . chown -R ${cfg.user}:${cfg.group} .
''; '';
serviceConfig = { serviceConfig = {
ExecStart = "${cfg.package}/bin/nginx -p ${cfg.statedir}"; ExecStart = "${cfg.package}/bin/nginx -p ${cfg.statedir}";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID"; ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
Restart = "always"; Restart = "always";
RestartSec = "10s"; RestartSec = "10s";
StartLimitInterval = "1min"; StartLimitInterval = "1min";
};
}; };
environment.etc.nginx.source = lancache; };
users.extraUsers = (singleton
{ name = cfg.user;
group = cfg.group;
uid = genid cfg.group;
});
users.extraGroups = (singleton environment.etc.nginx.source = lancache;
{ name = "${cfg.group}"; users.extraUsers = (singleton
gid = genid cfg.group; { name = cfg.user;
}); group = cfg.group;
uid = genid cfg.group;
});
users.extraGroups = (singleton
{ name = "${cfg.group}";
gid = genid cfg.group;
});
networking.firewall.allowedTCPPorts = [ 80 443 ];
} }