{ pkgs, lib, stdenv, fetchFromGitHub, debug ? false, pname ? "softether", logDir ? "/var/log/${pname}", pidDir ? "/run/${pname}", dbDir ? "/var/lib/${pname}", dataDir ? "/var/lib/${pname}", version ? "master", }: stdenv.mkDerivation (finalAttrs: { inherit pname version; src = fetchFromGitHub { owner = "SoftEtherVPN"; repo = "SoftEtherVPN"; tag = "${finalAttrs.version}"; hash = "sha256-KGcQNsHwEtJ0CR35XcW89UPqnnLlGus/zAGBZDgz5uo="; fetchSubmodules = true; }; patches = [ ./patches/ipb-profile-key.patch ./patches/tap-name-no-prefix.patch ./patches/prevent-dmesg-call.patch ./patches/simplify_l2tp_auth.patch ./patches/exit-client-on-disconnect.patch ]; nativeBuildInputs = with pkgs; [ cmake pkg-config libsodium # Add other build tools here ]; buildInputs = with pkgs; [ openssl readline ncurses zlib bash ]; cmakeFlags = [ "-DSE_PIDDIR=${pidDir}" "-DSE_LOGDIR=${logDir}" "-DSE_DBDIR=${dbDir}" "-DCMAKE_INSTALL_SYSTEMD_UNITDIR=" (lib.optionalString debug "-DCMAKE_BUILD_TYPE=Debug") "-DCMAKE_INSTALL_PREFIX=${placeholder "out"}" "-DCMAKE_INSTALL_LIBDIR=lib" "-DCMAKE_INSTALL_INCLUDEDIR=include" "-DCMAKE_INSTALL_LIBEXECDIR=libexec" ]; meta = { description = "Softether 5"; homepage = "https://www.softether.org/"; platforms = [ "x86_64-linux" "aarch64-linux" ]; }; })