From 58cfa8ee1fa0505fa2dc36abfe62940ba29c64bf Mon Sep 17 00:00:00 2001 From: Andrea Ciceri Date: Fri, 16 May 2025 16:02:18 +0200 Subject: [PATCH] Use amule module from my PR --- modules/amule/default.nix | 56 ++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 22 deletions(-) diff --git a/modules/amule/default.nix b/modules/amule/default.nix index 9752f8f..6416e9f 100644 --- a/modules/amule/default.nix +++ b/modules/amule/default.nix @@ -1,34 +1,46 @@ -{ config, lib, ... }: +{ config, pkgs, ... }: +let + rev = "966199fe1dccc9c6c7016bdb1d9582f27797bc02"; + amule-flake = builtins.getFlake "github:NixOS/nixpkgs/${rev}"; + inherit (amule-flake.legacyPackages.${pkgs.system}) amule-daemon amule-web; +in { - users.users.amule = { - isSystemUser = true; - group = "amule"; - extraGroups = [ "amule" ]; - home = config.services.amule.dataDir; - }; + disabledModules = [ "services/networking/amuled.nix" ]; + documentation.nixos.enable = false; + + imports = [ "${amule-flake}/nixos/modules/services/networking/amuled.nix" ]; - users.groups.amule = { }; services.amule = { - dataDir = "/mnt/hd/amule"; enable = true; - user = "amule"; + package = amule-daemon; + amuleWebPackage = amule-web; + openPeerPorts = true; + openWebServerPort = true; + # TODO the service is accessible only from the VPN + # however better using agenix + ExternalConnectPasswordFile = pkgs.writeText "password" "pippo"; + WebServerPasswordFile = pkgs.writeText "password" "pippo"; + settings = { + eMule = { + IncomingDir = "/mnt/hd/amule"; + TempDir = "/mnt/hd/amule/Temp"; + }; + WebServer = { + Enabled = 1; + }; + }; }; - # sometimes the service crashes with a segfeault without any reason... - systemd.services.amuled.serviceConfig.Restart = lib.mkForce "always"; - environment.persistence."/persist".directories = [ config.services.amule.dataDir ]; - networking.firewall = { - allowedTCPPorts = [ 4662 ]; - allowedUDPPortRanges = [ - { - from = 4665; - to = 4672; - } - ]; + services.nginx.virtualHosts."amule.sisko.wg.aciceri.dev" = { + forceSSL = true; + useACMEHost = "aciceri.dev"; + locations."/" = { + proxyPass = "http://localhost:${builtins.toString config.services.amule.settings.WebServer.Port}"; + }; + serverAliases = [ "amule.sisko.zt.aciceri.dev" ]; }; - }