rtorrent: track nginx changes

This commit is contained in:
lassulus 2017-09-06 09:50:39 +02:00
parent b17fa29b88
commit 6218a259a9

View File

@ -1,4 +1,4 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, options, ... }:
with import <stockholm/lib>; with import <stockholm/lib>;
let let
@ -73,6 +73,15 @@ 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";
addr = mkOption {
type = types.addr4;
default = "0.0.0.0";
description = ''
the address to listen on
default is 0.0.0.0
'';
};
port = mkOption { port = mkOption {
type = types.nullOr types.int; type = types.nullOr types.int;
description ='' description =''
@ -290,7 +299,7 @@ let
services.nginx.enable = mkDefault true; services.nginx.enable = mkDefault true;
services.nginx.virtualHosts.rtorrent = { services.nginx.virtualHosts.rtorrent = {
default = mkDefault true; default = mkDefault true;
inherit (webcfg) basicAuth port; inherit (webcfg) basicAuth;
root = optionalString rucfg.enable webdir; root = optionalString rucfg.enable webdir;
locations = { locations = {
@ -310,7 +319,15 @@ let
include ${pkgs.nginx}/conf/fastcgi.conf; 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 = { rutorrent-imp = {