Skip to content

Commit

Permalink
nixos/phpfpm: add user and group option to each pool
Browse files Browse the repository at this point in the history
  • Loading branch information
aanderse committed Aug 23, 2019
1 parent 62b774a commit a30a1e2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
3 changes: 1 addition & 2 deletions nixos/modules/services/web-apps/limesurvey.nix
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,10 @@ in
};

services.phpfpm.pools.limesurvey = {
inherit user group;
extraConfig = ''
listen.owner = ${config.services.httpd.user};
listen.group = ${config.services.httpd.group};
user = ${user};
group = ${group};
env[LIMESURVEY_CONFIG] = ${limesurveyConfig}
Expand Down
17 changes: 15 additions & 2 deletions nixos/modules/services/web-servers/phpfpm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ let
[${pool}]
listen = ${poolOpts.socket}
user = ${poolOpts.user}
group = ${poolOpts.group}
${poolOpts.extraConfig}
'';

Expand Down Expand Up @@ -71,10 +73,19 @@ let
'';
};

user = mkOption {
type = types.str;
description = "User account under which this pool runs.";
};

group = mkOption {
type = types.str;
description = "Group account under which this pool runs.";
};

extraConfig = mkOption {
type = types.lines;
example = ''
user = nobody
pm = dynamic
pm.max_children = 75
pm.start_servers = 10
Expand All @@ -93,6 +104,7 @@ let

config = {
socket = if poolOpts.listen == "" then "${stateDir}/${name}.sock" else poolOpts.listen;
group = mkDefault poolOpts.user;
};
};

Expand Down Expand Up @@ -138,9 +150,10 @@ in {
example = literalExample ''
{
mypool = {
user = "php";
group = "php";
phpPackage = pkgs.php;
extraConfig = '''
user = nobody
pm = dynamic
pm.max_children = 75
pm.start_servers = 10
Expand Down

0 comments on commit a30a1e2

Please sign in to comment.