about summary refs log tree commit diff
path: root/nixpkgs/pkgs/servers/ebusd
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/servers/ebusd')
-rw-r--r--nixpkgs/pkgs/servers/ebusd/default.nix56
-rw-r--r--nixpkgs/pkgs/servers/ebusd/patches/ebusd-cmake.patch21
2 files changed, 77 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/servers/ebusd/default.nix b/nixpkgs/pkgs/servers/ebusd/default.nix
new file mode 100644
index 000000000000..bc20b930aef0
--- /dev/null
+++ b/nixpkgs/pkgs/servers/ebusd/default.nix
@@ -0,0 +1,56 @@
+{ lib, stdenv, pkgs, fetchFromGitHub, fetchpatch, argparse, mosquitto, cmake, autoconf, automake, libtool, pkg-config, openssl }:
+
+stdenv.mkDerivation rec {
+  pname = "ebusd";
+  version = "23.3";
+
+  src = fetchFromGitHub {
+    owner = "john30";
+    repo = "ebusd";
+    rev = version;
+    sha256 = "sha256-K3gZ5OudNA92S38U1+HndxjA7OVfh2ymYf8OetB646M=";
+  };
+
+  nativeBuildInputs = [
+    cmake
+    autoconf
+    automake
+    libtool
+    pkg-config
+  ];
+
+  buildInputs = [
+    argparse
+    mosquitto
+    openssl
+  ];
+
+  patches = [
+    ./patches/ebusd-cmake.patch
+    # Upstream patch for gcc-13 copmpatibility:
+    (fetchpatch {
+      name = "gcc-13.patch";
+      url = "https://github.com/john30/ebusd/commit/3384f3780087bd6b94d46bf18cdad18201ad516c.patch";
+      hash = "sha256-+wZDHjGaIhBCqhy2zmIE8Ko3uAiw8kfKx64etCqRQjM=";
+    })
+  ];
+
+  cmakeFlags = [
+    "-DCMAKE_INSTALL_SYSCONFDIR=${placeholder "out"}/etc"
+    "-DCMAKE_INSTALL_BINDIR=${placeholder "out"}/bin"
+    "-DCMAKE_INSTALL_LOCALSTATEDIR=${placeholder "TMPDIR"}"
+  ];
+
+  postInstall = ''
+    mv $out/usr/bin $out
+    rmdir $out/usr
+  '';
+
+  meta = with lib; {
+    description = "ebusd";
+    homepage = "https://github.com/john30/ebusd";
+    license = licenses.gpl3Only;
+    maintainers = with maintainers; [ nathan-gs ];
+    platforms = platforms.linux;
+ };
+}
diff --git a/nixpkgs/pkgs/servers/ebusd/patches/ebusd-cmake.patch b/nixpkgs/pkgs/servers/ebusd/patches/ebusd-cmake.patch
new file mode 100644
index 000000000000..347caa88a615
--- /dev/null
+++ b/nixpkgs/pkgs/servers/ebusd/patches/ebusd-cmake.patch
@@ -0,0 +1,21 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -184,16 +184,11 @@
+ add_subdirectory(src/lib/knx)
+ add_subdirectory(src/tools)
+
+-if(EXISTS "${ROOT}/etc/debian_version")
+-  install(FILES ${CMAKE_SOURCE_DIR}/contrib/debian/default/ebusd DESTINATION /etc/default/)
+-  install(FILES ${CMAKE_SOURCE_DIR}/contrib/debian/init.d/ebusd DESTINATION /etc/init.d/)
+-  install(FILES ${CMAKE_SOURCE_DIR}/contrib/debian/systemd/ebusd.service DESTINATION /lib/systemd/system/)
+-endif()
+ if(HAVE_MQTT)
+   FILE(GLOB MQTT_CFG_FILES "${CMAKE_SOURCE_DIR}/contrib/etc/ebusd/mqtt-*.cfg")
+-  install(FILES ${MQTT_CFG_FILES} DESTINATION /etc/ebusd/)
++  install(FILES ${MQTT_CFG_FILES} DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/ebusd/)
+ endif(HAVE_MQTT)
+ if(HAVE_KNX)
+   FILE(GLOB KNX_CFG_FILES "${CMAKE_SOURCE_DIR}/contrib/etc/ebusd/knx*.cfg")
+-  install(FILES ${KNX_CFG_FILES} DESTINATION /etc/ebusd/)
++  install(FILES ${KNX_CFG_FILES} DESTINATION ${CMAKE_INSTALL_SYSCONFDIR}/ebusd/)
+ endif(HAVE_KNX)