summaryrefslogtreecommitdiffstats
path: root/krebs/3modules/rtorrent.nix
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2017-09-06 09:50:39 +0200
committerlassulus <lassulus@lassul.us>2017-09-06 11:05:45 +0200
commit6218a259a9880368c71ecacddcf1e7c641bd5278 (patch)
tree69bc11e6129a8d102b785bbb087be5d0f22ba9a2 /krebs/3modules/rtorrent.nix
parentb17fa29b889f26c8822850bb2bb80ddbd376e4cb (diff)
rtorrent: track nginx changes
Diffstat (limited to 'krebs/3modules/rtorrent.nix')
-rw-r--r--krebs/3modules/rtorrent.nix23
1 files changed, 20 insertions, 3 deletions
diff --git a/krebs/3modules/rtorrent.nix b/krebs/3modules/rtorrent.nix
index d8551899..472accef 100644
--- a/krebs/3modules/rtorrent.nix
+++ b/krebs/3modules/rtorrent.nix
@@ -1,4 +1,4 @@
-{ config, lib, pkgs, ... }:
+{ config, lib, pkgs, options, ... }:
with import <stockholm/lib>;
let
@@ -73,6 +73,15 @@ let
# authentication also applies to rtorrent.rutorrent
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 {
type = types.nullOr types.int;
description =''
@@ -290,7 +299,7 @@ let
services.nginx.enable = mkDefault true;
services.nginx.virtualHosts.rtorrent = {
default = mkDefault true;
- inherit (webcfg) basicAuth port;
+ inherit (webcfg) basicAuth;
root = optionalString rucfg.enable webdir;
locations = {
@@ -310,7 +319,15 @@ 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 = {