Site musique en module
This commit is contained in:
parent
df18298920
commit
735d4e2c33
3 changed files with 70 additions and 17 deletions
|
@ -22,7 +22,11 @@ in
|
|||
};
|
||||
|
||||
services = mkOption {
|
||||
type = types.attrsOf types.attrs;
|
||||
type = with types; attrsOf (submodule { options = {
|
||||
ip = mkOption { type = str; description = "IP address"; };
|
||||
port = mkOption { type = int; description = "Port number"; };
|
||||
auth = mkOption { type = bool; description = "Enable authentification"; default = false; };
|
||||
}; });
|
||||
example = ''
|
||||
haproxy_backends = {
|
||||
example = { ip = "127.0.0.1"; port = 1234; auth = false; };
|
||||
|
|
61
services/site-musique.nix
Normal file
61
services/site-musique.nix
Normal file
|
@ -0,0 +1,61 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.services.site-musique;
|
||||
in
|
||||
{
|
||||
options.services.site-musique = {
|
||||
enable = mkEnableOption "Site musique";
|
||||
|
||||
port = mkOption {
|
||||
type = types.int;
|
||||
example = 54321;
|
||||
description = "Local listening port";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
services.haproxy-acme.services = {
|
||||
musique = { ip = "127.0.0.1"; port = cfg.port; auth = false; };
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts = {
|
||||
"musique" = {
|
||||
listen = [ { addr = "127.0.0.1"; port = cfg.port; } ];
|
||||
locations."/" = {
|
||||
root = pkgs.site-musique;
|
||||
index = "index.php";
|
||||
extraConfig = ''
|
||||
location ~* \.php$ {
|
||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||
fastcgi_pass unix:/run/phpfpm/musique;
|
||||
include ${pkgs.nginx}/conf/fastcgi_params;
|
||||
include ${pkgs.nginx}/conf/fastcgi.conf;
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services.phpfpm.poolConfigs.musique = ''
|
||||
listen = /run/phpfpm/musique
|
||||
listen.owner = nginx
|
||||
listen.group = nginx
|
||||
listen.mode = 0660
|
||||
user = nginx
|
||||
pm = dynamic
|
||||
pm.max_children = 75
|
||||
pm.start_servers = 2
|
||||
pm.min_spare_servers = 1
|
||||
pm.max_spare_servers = 20
|
||||
pm.max_requests = 500
|
||||
php_admin_value[error_log] = 'stderr'
|
||||
php_admin_flag[log_errors] = on
|
||||
catch_workers_output = yes
|
||||
'';
|
||||
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue