about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/uhub
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/uhub')
-rw-r--r--nixpkgs/pkgs/servers/uhub/default.nix59
-rw-r--r--nixpkgs/pkgs/servers/uhub/plugin-dir.patch19
2 files changed, 78 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/uhub/default.nix b/nixpkgs/pkgs/servers/uhub/default.nix
new file mode 100644
index 000000000000..52866784faa9
--- /dev/null
+++ b/nixpkgs/pkgs/servers/uhub/default.nix
@@ -0,0 +1,59 @@
+{ stdenv, fetchpatch, fetchFromGitHub, cmake, openssl, sqlite, pkgconfig, systemd
+, tlsSupport ? false }:
+
+assert tlsSupport -> openssl != null;
+
+stdenv.mkDerivation rec {
+  name = "uhub-${version}";
+  version = "0.5.0";
+
+  src = fetchFromGitHub {
+    owner = "janvidar";
+    repo = "uhub";
+    rev = version;
+    sha256 = "0zdbxfvw7apmfhqgsfkfp4pn9iflzwdn0zwvzymm5inswfc00pxg";
+  };
+
+  nativeBuildInputs = [ pkgconfig ];
+  buildInputs = [ cmake sqlite systemd ] ++ stdenv.lib.optional tlsSupport openssl;
+
+  outputs = [ "out"
+    "mod_example"
+    "mod_welcome"
+    "mod_logging"
+    "mod_auth_simple"
+    "mod_auth_sqlite"
+    "mod_chat_history"
+    "mod_chat_only"
+    "mod_topic"
+    "mod_no_guest_downloads"
+  ];
+
+  patches = [
+    ./plugin-dir.patch
+    # fix aarch64 build: https://github.com/janvidar/uhub/issues/46
+    (fetchpatch {
+      url = "https://github.com/janvidar/uhub/pull/47.patch";
+      sha256 = "07yik6za89ar5bxm7m2183i7f6hfbawbxvd4vs02n1zr2fgfxmiq";
+    })
+
+    # Fixed compilation on systemd > 210
+    (fetchpatch {
+      url = "https://github.com/janvidar/uhub/commit/70f2a43f676cdda5961950a8d9a21e12d34993f8.diff";
+      sha256 = "1jp8fvw6f9jh0sdjml9mahkk6p6b96p6rzg2y601mnnbcdj8y8xp";
+    })
+  ];
+
+  cmakeFlags = ''
+    -DSYSTEMD_SUPPORT=ON
+    ${if tlsSupport then "-DSSL_SUPPORT=ON" else "-DSSL_SUPPORT=OFF"}
+  '';
+
+  meta = with stdenv.lib; {
+    description = "High performance peer-to-peer hub for the ADC network";
+    homepage = https://www.uhub.org/;
+    license = licenses.gpl3;
+    maintainers = [ maintainers.ehmry ];
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/servers/uhub/plugin-dir.patch b/nixpkgs/pkgs/servers/uhub/plugin-dir.patch
new file mode 100644
index 000000000000..d29d600425ff
--- /dev/null
+++ b/nixpkgs/pkgs/servers/uhub/plugin-dir.patch
@@ -0,0 +1,19 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -241,8 +241,14 @@
+ 
+ if (UNIX)
+ 	install( TARGETS uhub uhub-passwd RUNTIME DESTINATION bin )
+-	install( TARGETS mod_example mod_welcome mod_logging mod_auth_simple mod_auth_sqlite mod_chat_history mod_chat_history_sqlite mod_chat_only mod_topic mod_no_guest_downloads DESTINATION /usr/lib/uhub/ OPTIONAL )
+-	install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/doc/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION /etc/uhub OPTIONAL )
++
++    set( PLUGINS mod_example mod_welcome mod_logging mod_auth_simple mod_auth_sqlite mod_chat_history mod_chat_only mod_topic mod_no_guest_downloads )
++
++    foreach( PLUGIN ${PLUGINS} )
++        install( TARGETS ${PLUGIN} DESTINATION $ENV{${PLUGIN}} OPTIONAL )
++    endforeach( PLUGIN )
++
++	install( FILES ${CMAKE_SOURCE_DIR}/doc/uhub.conf ${CMAKE_SOURCE_DIR}/doc/plugins.conf ${CMAKE_SOURCE_DIR}/doc/rules.txt ${CMAKE_SOURCE_DIR}/doc/motd.txt DESTINATION doc/ OPTIONAL )
+ endif()
+ 
+