summaryrefslogtreecommitdiffstats
path: root/makefu/2configs
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2017-06-28 08:46:55 +0200
committermakefu <github@syntax-fehler.de>2017-06-28 08:46:55 +0200
commit9bd7f9ebf4055534ace98002a1a9ddbb243805d1 (patch)
tree12d5ec90b8524f7980f1028be405b7fea614613b /makefu/2configs
parent5569053e87a7b0091653bd4918dec8aa3a1761bc (diff)
ma lancache: fix nginx prefix issues
nginx is unable to have a config with relativ paths and a statedir somewhere else. this is why i now prepare the 'prefix' with everything in it.
Diffstat (limited to 'makefu/2configs')
-rw-r--r--makefu/2configs/lancache.nix28
1 files changed, 11 insertions, 17 deletions
diff --git a/makefu/2configs/lancache.nix b/makefu/2configs/lancache.nix
index 8ec401361..ff5b0d788 100644
--- a/makefu/2configs/lancache.nix
+++ b/makefu/2configs/lancache.nix
@@ -2,9 +2,6 @@
with import <stockholm/lib>;
let
# see https://github.com/zeropingheroes/lancache for full docs
- cachedir = "/var/lancache/cache";
- logdir = "/var/lancache/log";
-
lancache= pkgs.stdenv.mkDerivation rec {
name = "lancache-2017-06-26";
src = pkgs.fetchFromGitHub {
@@ -21,13 +18,14 @@ let
mkdir -p $out
cp -r * $out/
sed -i -e 's/^\(user\).*/\1 ${cfg.user} ${cfg.group};/' \
- -e 's/^\(error_log\).*/\1 stderr;\ndaemon off;/' $out/nginx.conf
+ -e '1 idaemon off;' \
+ $out/nginx.conf
'';
};
cfg = {
group = "nginx-lancache";
user = "nginx-lancache";
- stateDir = "/var/lancache";
+ statedir = "/var/lancache";
package = pkgs.stdenv.lib.overrideDerivation pkgs.nginx (old:{
configureFlags = old.configureFlags ++ [
"--with-http_slice_module"
@@ -44,27 +42,23 @@ in {
restartIfChanged = true;
preStart = ''
- PATH_CACHE="/var/lancache/cache"
- PATH_LOGS="/var/lancache/logs"
- WWW_USER="${cfg.user}"
- WWW_GROUP="${cfg.group}"
-
- mkdir -p $PATH_CACHE
- cd $PATH_CACHE
- mkdir -p installers tmp
- mkdir -p $PATH_LOGS
+ mkdir -p ${cfg.statedir} && cd ${cfg.statedir}
+ PATH_CACHE=$PATH_BASE/cache
+ PATH_LOGS=$PATH_BASE/logs
- chown -R $WWW_USER:$WWW_USER $PATH_CACHE
- chown -R $WWW_USER:$WWW_USER $PATH_LOGS
+ mkdir -p cache/{installers,tmp} logs
+ rm -f conf; ln -s ${lancache} conf
+ chown -R ${cfg.user}:${cfg.group} .
'';
serviceConfig = {
- ExecStart = "${cfg.package}/bin/nginx -c ${lancache}/nginx.conf -p ${lancache}";
+ ExecStart = "${cfg.package}/bin/nginx -p ${cfg.statedir}";
ExecReload = "${pkgs.coreutils}/bin/kill -HUP $MAINPID";
Restart = "always";
RestartSec = "10s";
StartLimitInterval = "1min";
};
};
+ environment.etc.nginx.source = lancache;
users.extraUsers = (singleton
{ name = cfg.user;
group = cfg.group;