mirror of
https://github.com/vale981/phoebe
synced 2025-03-05 09:51:37 -05:00
New module for nginx
This commit is contained in:
parent
e742614c30
commit
6c7065945c
3 changed files with 44 additions and 0 deletions
|
@ -9,6 +9,13 @@ Module List
|
|||
|
||||
Automatically enable various security related settings for NixOS.
|
||||
|
||||
* `phoebe.services.nginx`:
|
||||
|
||||
Extra configuration for nginx (if it's enabled elsewhere). For
|
||||
example, automatically use syslog so no log files need to be
|
||||
rotated. See the `phoebe.services.nginx.syslog` option for more
|
||||
details.
|
||||
|
||||
* `phoebe.services.postgresql`:
|
||||
|
||||
Start and manage PostgreSQL, including automatic user and database
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
{
|
||||
imports = [
|
||||
./nginx
|
||||
./rails
|
||||
];
|
||||
}
|
||||
|
|
36
modules/services/web/nginx/default.nix
Normal file
36
modules/services/web/nginx/default.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
# Extra configuration for nginx:
|
||||
{ config, lib, pkgs, ...}:
|
||||
|
||||
# Bring in library functions:
|
||||
with lib;
|
||||
|
||||
let
|
||||
##############################################################################
|
||||
# Save some typing.
|
||||
cfg = config.phoebe.services.nginx;
|
||||
|
||||
in
|
||||
{
|
||||
#### Interface
|
||||
options.phoebe.services.nginx = {
|
||||
syslog = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to send nginx logging to syslog/journald.
|
||||
|
||||
This option only applies if nginx is enabled.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
#### Implementation
|
||||
config = mkMerge [
|
||||
(mkIf (config.services.nginx.enable && cfg.syslog) {
|
||||
services.nginx.commonHttpConfig = ''
|
||||
access_log syslog:server=unix:/dev/log;
|
||||
error_log syslog:server=unix:/dev/log;
|
||||
'';
|
||||
})
|
||||
];
|
||||
}
|
Loading…
Add table
Reference in a new issue