diff --git a/modules/server/misc/torrserver/default.nix b/modules/server/misc/torrserver/default.nix index 8642d5e..b0fc99c 100644 --- a/modules/server/misc/torrserver/default.nix +++ b/modules/server/misc/torrserver/default.nix @@ -55,19 +55,26 @@ in { Group = "torrserver"; Type = "simple"; NonBlocking = true; - WorkingDirectory = "/var/lib/torrserver"; + WorkingDirectory = "/etc/torrserver"; ExecStart = "${pkg}/bin/torrserver --port ${toString cfg.port}"; ExecReload = "/bin/sh kill -HUP \${MAINPID}"; ExecStop = "/bin/sh kill -INT \${MAINPID}"; TimeoutSec = 30; Restart = "on-failure"; RestartSec = "5s"; - StateDirectory = "torrserver"; + # note: StateDirectory = "torrserver"; }; wantedBy = [ "multi-user.target" ]; }; + system.activationScripts.torrserver = lib.stringAfter [ "var" ] '' + mkdir -p /etc/torrserver + chown -R torrserver:torrserver /etc/torrserver + ''; + + environment.etc."torrserver/accs.db".text = mkIf webIsSupported (builtins.toJSON cfg.users); + users.groups.torrserver = {}; users.users.torrserver = { group = "torrserver"; @@ -79,8 +86,6 @@ in { services.nginx.virtualHosts."ts.${domain}" = mkIf webIsSupported { locations."/".proxyPass = "http://localhost:${toString cfg.port}"; - basicAuth = cfg.users; - enableACME = true; forceSSL = true; };