diff options
Diffstat (limited to 'krebs/3modules/rtorrent.nix')
-rw-r--r-- | krebs/3modules/rtorrent.nix | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/krebs/3modules/rtorrent.nix b/krebs/3modules/rtorrent.nix index 09e55201..e5566f32 100644 --- a/krebs/3modules/rtorrent.nix +++ b/krebs/3modules/rtorrent.nix @@ -8,7 +8,7 @@ let nginx-user = config.services.nginx.user; nginx-group = config.services.nginx.group; - fpm-socket = "/var/run/php5-fpm-rutorrent.sock"; + fpm-socket = config.services.phpfpm.pools.rutorrent.socket; webdir = rucfg.webdir; systemd-logfile = cfg.workDir + "/rtorrent-systemd.log"; @@ -186,7 +186,7 @@ let }; extraConfig = mkOption { - type = types.string; + type = types.lines; description = '' config to be placed into ${cfg.workDir}/.rtorrent.rc @@ -301,6 +301,7 @@ let default = mkDefault true; inherit (webcfg) basicAuth; root = optionalString rucfg.enable webdir; + listen = [ { inherit (webcfg) addr port; } ]; locations = { "/RPC2".extraConfig = '' @@ -319,38 +320,28 @@ let include ${pkgs.nginx}/conf/fastcgi.conf; ''; } ); - # workaround because upstream nginx api changed - # TODO remove when nobody uses 17.03 anymore - } // (if hasAttr "port" (head options.services.nginx.virtualHosts.type.getSubModules).submodule.options then { - port = webcfg.port; - } else { - listen = [ - { inherit (webcfg) addr port; } - ]; - }); + }; }; rutorrent-imp = { services.phpfpm = { - # phpfpm does not have an enable option - poolConfigs = { - rutorrent = '' - user = ${nginx-user} - group = ${nginx-group} - listen = ${fpm-socket} - listen.owner = ${nginx-user} - listen.group = ${nginx-group} - pm = dynamic - pm.max_children = 5 - pm.start_servers = 2 - pm.min_spare_servers = 1 - pm.max_spare_servers = 3 - chdir = / - php_admin_value[error_log] = 'stderr' - php_admin_flag[log_errors] = on - catch_workers_output = yes - env[PATH] = ${makeBinPath rutorrent-deps} - ''; + pools.rutorrent = { + user = nginx-user; + group = nginx-group; + phpEnv.PATH = makeBinPath rutorrent-deps; + + settings = { + "listen.owner" = nginx-user; + "pm" = "dynamic"; + "pm.max_children" = 5; + "pm.start_servers" = 2; + "pm.min_spare_servers" = 1; + "pm.max_spare_servers" = 3; + "chdir" = "/"; + "php_admin_value[error_log]" = "stderr"; + "php_admin_flag[log_errors]" = "on"; + "catch_workers_output" = "yes"; + }; }; }; }; |