mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-21 20:34:06 +00:00
Merge pull request #141 from orbitz/fix-nginx-required-config
Fix nginx required config
This commit is contained in:
commit
25cd3579cb
@ -1,14 +1,16 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
|
||||
with pkgs.lib;
|
||||
|
||||
|
||||
let
|
||||
cfg = config.services.nginx;
|
||||
configFile = pkgs.writeText "nginx.conf" ''
|
||||
user nginx nginx;
|
||||
daemon off;
|
||||
${cfg.config}
|
||||
'';
|
||||
in
|
||||
|
||||
|
||||
{
|
||||
options = {
|
||||
services.nginx = {
|
||||
@ -18,9 +20,9 @@ in
|
||||
Enable the nginx Web Server.
|
||||
";
|
||||
};
|
||||
|
||||
|
||||
config = mkOption {
|
||||
default = "";
|
||||
default = "events {}";
|
||||
description = "
|
||||
Verbatim nginx.conf configuration.
|
||||
";
|
||||
@ -33,14 +35,14 @@ in
|
||||
";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ pkgs.nginx ];
|
||||
|
||||
# TODO: test user supplied config file pases syntax test
|
||||
|
||||
|
||||
systemd.services.nginx = {
|
||||
description = "Nginx Web Server";
|
||||
after = [ "network.target" ];
|
||||
@ -55,11 +57,11 @@ in
|
||||
ExecStart = "${pkgs.nginx}/bin/nginx -c ${configFile} -p ${cfg.stateDir}";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
users.extraUsers.nginx = {
|
||||
group = "nginx";
|
||||
};
|
||||
|
||||
|
||||
users.extraGroups.nginx = {};
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user