k 3 rtorrent: krebs.nginx -> services.nginx

this will break compatibility with krebs.nginx for rutorrent and rtorrent-web
This commit is contained in:
makefu 2016-12-22 15:38:56 +01:00
parent afbe4f22c3
commit dace21d163
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225

View File

@ -73,22 +73,23 @@ let
# authentication also applies to rtorrent.rutorrent # authentication also applies to rtorrent.rutorrent
enable = mkEnableOption "rtorrent nginx web RPC"; enable = mkEnableOption "rtorrent nginx web RPC";
listenAddress = mkOption { port = mkOption {
type = types.str; type = types.nullOr types.int;
description ='' description =''
nginx listen address for rtorrent web nginx listen port for rtorrent
''; '';
default = "localhost:8006"; default = 8006;
}; };
enableAuth = mkEnableOption "rutorrent authentication"; basicAuth = mkOption {
authfile = mkOption { type = types.attrsOf types.str ;
type = types.path;
description = '' description = ''
basic authentication file to be used. basic authentication to be used. If unset, no authentication will be
Use `${pkgs.apacheHttpd}/bin/htpasswd -c <file> <username>` to create the file. enabled.
Only in use if authentication is enabled.
Refer to `services.nginx.virtualHosts.<name>.basicAuth`
''; '';
default = {};
}; };
}; };
@ -104,7 +105,6 @@ let
default = pkgs.rutorrent; default = pkgs.rutorrent;
}; };
webdir = mkOption { webdir = mkOption {
type = types.path; type = types.path;
description = '' description = ''
@ -286,36 +286,28 @@ let
}; };
rpcweb-imp = { rpcweb-imp = {
krebs.nginx.enable = mkDefault true; services.nginx.enable = mkDefault true;
krebs.nginx.servers.rtorrent = { services.nginx.virtualHosts.rtorrent = {
listen = [ webcfg.listenAddress ]; default = mkDefault true;
server-names = [ "default" ]; inherit (webcfg) basicAuth port;
extraConfig = '' root = optionalString rucfg.enable webdir;
${optionalString webcfg.enableAuth ''
auth_basic "rtorrent"; locations = {
auth_basic_user_file ${webcfg.authfile}; "/RPC2".extraConfig = ''
''}
${optionalString rucfg.enable ''
root ${webdir};
''}
'';
locations = [
(nameValuePair "/RPC2" ''
include ${pkgs.nginx}/conf/scgi_params; include ${pkgs.nginx}/conf/scgi_params;
scgi_param SCRIPT_NAME /RPC2; scgi_param SCRIPT_NAME /RPC2;
scgi_pass unix:${cfg.xmlrpc-socket}; scgi_pass unix:${cfg.xmlrpc-socket};
'') '';
] ++ (optional rucfg.enable } // (optionalAttrs rucfg.enable {
(nameValuePair "~ \.php$" '' "~ \.php$".extraConfig = ''
client_max_body_size 200M; client_max_body_size 200M;
root ${webdir};
fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:${fpm-socket}; fastcgi_pass unix:${fpm-socket};
try_files $uri =404; try_files $uri =404;
fastcgi_index index.php; fastcgi_index index.php;
include ${pkgs.nginx}/conf/fastcgi_params; include ${pkgs.nginx}/conf/fastcgi_params;
include ${pkgs.nginx}/conf/fastcgi.conf; include ${pkgs.nginx}/conf/fastcgi.conf;
'') ''; }
); );
}; };
}; };