Work around nginx problem in 20.03
This commit is contained in:
parent
ed2bc14032
commit
3e3c1754a5
1 changed files with 10 additions and 5 deletions
|
@ -19,10 +19,15 @@
|
||||||
{
|
{
|
||||||
services.webserver = { config, pkgs, ... }: {
|
services.webserver = { config, pkgs, ... }: {
|
||||||
|
|
||||||
nixos.configuration = {config, pkgs, ...}: {
|
nixos.configuration = {config, lib, options, pkgs, ...}: {
|
||||||
boot.isContainer = true;
|
boot.isContainer = true;
|
||||||
services.nginx.enable = true;
|
services.nginx = {
|
||||||
services.nginx.virtualHosts.localhost.root = "${pkgs.nix.doc}/share/doc/nix/manual";
|
enable = true;
|
||||||
|
virtualHosts.localhost.root = "${pkgs.nix.doc}/share/doc/nix/manual";
|
||||||
|
} // lib.optionalAttrs (options?services.nginx.stateDir) {
|
||||||
|
# Work around a problem in NixOS 20.03
|
||||||
|
stateDir = "/var/lib/nginx";
|
||||||
|
};
|
||||||
system.build.run-nginx = pkgs.writeScript "run-nginx" ''
|
system.build.run-nginx = pkgs.writeScript "run-nginx" ''
|
||||||
#!${pkgs.bash}/bin/bash
|
#!${pkgs.bash}/bin/bash
|
||||||
PATH='${config.systemd.services.nginx.environment.PATH}'
|
PATH='${config.systemd.services.nginx.environment.PATH}'
|
||||||
|
@ -30,8 +35,8 @@
|
||||||
echo nginx:x:${toString config.users.groups.nginx.gid}:nginx >>/etc/group
|
echo nginx:x:${toString config.users.groups.nginx.gid}:nginx >>/etc/group
|
||||||
echo 'nobody:x:65534:65534:Unprivileged account do not use:/var/empty:/run/current-system/sw/bin/nologin' >>/etc/passwd
|
echo 'nobody:x:65534:65534:Unprivileged account do not use:/var/empty:/run/current-system/sw/bin/nologin' >>/etc/passwd
|
||||||
echo 'nogroup:x:65534:' >>/etc/group
|
echo 'nogroup:x:65534:' >>/etc/group
|
||||||
mkdir -p /var/log/nginx /run/nginx/ /var/cache/nginx
|
mkdir -p /var/log/nginx /run/nginx/ /var/cache/nginx /var/lib/nginx/{,logs,proxy_temp,client_body_temp,fastcgi_temp,scgi_temp,uwsgi_temp}
|
||||||
chown nginx /var/log/nginx /run/nginx/ /var/cache/nginx
|
chown nginx /var/log/nginx /run/nginx/ /var/cache/nginx /var/lib/nginx/{,logs,proxy_temp,client_body_temp,fastcgi_temp,scgi_temp,uwsgi_temp}
|
||||||
${config.systemd.services.nginx.runner}
|
${config.systemd.services.nginx.runner}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue