From 036289a0a119159901e20c272b97c00412e41676 Mon Sep 17 00:00:00 2001 From: makefu Date: Mon, 28 Feb 2022 21:31:52 +0100 Subject: ma omo.r: enable more services --- makefu/1systems/latte/config.nix | 18 +++++++-- makefu/1systems/omo/config.nix | 7 ++++ makefu/2configs/torrent.nix | 73 ------------------------------------ makefu/2configs/torrent/rtorrent.nix | 73 ++++++++++++++++++++++++++++++++++++ 4 files changed, 95 insertions(+), 76 deletions(-) delete mode 100644 makefu/2configs/torrent.nix create mode 100644 makefu/2configs/torrent/rtorrent.nix (limited to 'makefu') diff --git a/makefu/1systems/latte/config.nix b/makefu/1systems/latte/config.nix index fdd3df192..5332fadf5 100644 --- a/makefu/1systems/latte/config.nix +++ b/makefu/1systems/latte/config.nix @@ -29,10 +29,19 @@ in { # Storage + # Services: + # + # + + + + # local usage: + + # Supervision @@ -40,9 +49,9 @@ in { # Krebs - # - # configure your hw: - # + # backup + + ]; krebs = { @@ -50,4 +59,7 @@ in { build.host = config.krebs.hosts.latte; }; + makefu.dl-dir = "/media/cloud/download"; + networking.firewall.allowedTCPPorts = [ 80 ]; + } diff --git a/makefu/1systems/omo/config.nix b/makefu/1systems/omo/config.nix index 3a216ea76..42f335264 100644 --- a/makefu/1systems/omo/config.nix +++ b/makefu/1systems/omo/config.nix @@ -43,14 +43,18 @@ in { + # # # + + + { krebs.airdcpp.dcpp.shares = let d = path: "/media/cryptX/${path}"; @@ -96,6 +100,8 @@ in { + + # @@ -104,6 +110,7 @@ in { enable = true; servedir = "/media/cryptX/emu/ps3"; }; + users.users.makefu.packages = [ pkgs.pkgrename ]; } diff --git a/makefu/2configs/torrent.nix b/makefu/2configs/torrent.nix deleted file mode 100644 index 74f1e5fe8..000000000 --- a/makefu/2configs/torrent.nix +++ /dev/null @@ -1,73 +0,0 @@ -{ config, lib, pkgs, ... }: - -with import ; - -let - basicAuth = import ; - peer-port = 51412; - web-port = 8112; - daemon-port = 58846; - base-dir = config.krebs.rtorrent.workDir; -in { - - users.users = { - download = { - name = "download"; - home = base-dir; - uid = mkDefault (genid "download"); - createHome = true; - useDefaultShell = true; - group = "download"; - openssh.authorizedKeys.keys = [ ]; - }; - }; - - users.extraGroups = { - download = { - gid = lib.mkDefault (genid "download"); - members = [ - config.krebs.build.user.name - "download" - "rtorrent" - "nginx" - ]; - }; - rtorrent.members = [ "download" ]; - }; - - krebs.rtorrent = let - d = config.makefu.dl-dir; - in { - enable = true; - web = { - enable = true; - port = web-port; - inherit basicAuth; - }; - rutorrent.enable = true; - enableXMLRPC = true; - listenPort = peer-port; - downloadDir = d + "/finished/incoming"; - watchDir = d + "/watch"; - # TODO: maybe test out multiple watch dirs with tags: https://github.com/rakshasa/rtorrent/wiki/TORRENT-Watch-directories - extraConfig = '' - # log.add_output = "debug", "rtorrent-systemd" - # log.add_output = "dht_debug", "rtorrent-systemd" - # log.add_output = "tracker_debug", "rtorrent-systemd" - log.add_output = "rpc_events", "rtorrent-systemd" - # log.add_output = "rpc_dump", "rtorrent-systemd" - system.daemon.set = true - ''; - # dump old torrents into watch folder to have them re-added - }; - - services.nginx.virtualHosts."torrent.${config.krebs.build.host.name}.r".locations."/" = { proxyPass = "http://localhost:${toString web-port}/"; }; - - networking.firewall.extraCommands = '' - iptables -A INPUT -i retiolum -p tcp --dport ${toString web-port} -j ACCEPT - ''; - - networking.firewall.allowedTCPPorts = [ peer-port ]; - networking.firewall.allowedUDPPorts = [ peer-port ]; - state = [ config.krebs.rtorrent.sessionDir ]; # state which torrents were loaded -} diff --git a/makefu/2configs/torrent/rtorrent.nix b/makefu/2configs/torrent/rtorrent.nix new file mode 100644 index 000000000..74f1e5fe8 --- /dev/null +++ b/makefu/2configs/torrent/rtorrent.nix @@ -0,0 +1,73 @@ +{ config, lib, pkgs, ... }: + +with import ; + +let + basicAuth = import ; + peer-port = 51412; + web-port = 8112; + daemon-port = 58846; + base-dir = config.krebs.rtorrent.workDir; +in { + + users.users = { + download = { + name = "download"; + home = base-dir; + uid = mkDefault (genid "download"); + createHome = true; + useDefaultShell = true; + group = "download"; + openssh.authorizedKeys.keys = [ ]; + }; + }; + + users.extraGroups = { + download = { + gid = lib.mkDefault (genid "download"); + members = [ + config.krebs.build.user.name + "download" + "rtorrent" + "nginx" + ]; + }; + rtorrent.members = [ "download" ]; + }; + + krebs.rtorrent = let + d = config.makefu.dl-dir; + in { + enable = true; + web = { + enable = true; + port = web-port; + inherit basicAuth; + }; + rutorrent.enable = true; + enableXMLRPC = true; + listenPort = peer-port; + downloadDir = d + "/finished/incoming"; + watchDir = d + "/watch"; + # TODO: maybe test out multiple watch dirs with tags: https://github.com/rakshasa/rtorrent/wiki/TORRENT-Watch-directories + extraConfig = '' + # log.add_output = "debug", "rtorrent-systemd" + # log.add_output = "dht_debug", "rtorrent-systemd" + # log.add_output = "tracker_debug", "rtorrent-systemd" + log.add_output = "rpc_events", "rtorrent-systemd" + # log.add_output = "rpc_dump", "rtorrent-systemd" + system.daemon.set = true + ''; + # dump old torrents into watch folder to have them re-added + }; + + services.nginx.virtualHosts."torrent.${config.krebs.build.host.name}.r".locations."/" = { proxyPass = "http://localhost:${toString web-port}/"; }; + + networking.firewall.extraCommands = '' + iptables -A INPUT -i retiolum -p tcp --dport ${toString web-port} -j ACCEPT + ''; + + networking.firewall.allowedTCPPorts = [ peer-port ]; + networking.firewall.allowedUDPPorts = [ peer-port ]; + state = [ config.krebs.rtorrent.sessionDir ]; # state which torrents were loaded +} -- cgit v1.2.3