package.nix (1810B)
1 { 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 cmake, 6 spdlog, 7 yaml-cpp, 8 libcpr, 9 cxxopts, 10 nlohmann_json, 11 influxdb-cxx, 12 boost188, 13 curl, 14 paho-mqtt-cpp, 15 paho-mqtt-c, 16 stduuid, 17 microsoft-gsl, 18 catch2, 19 }: 20 21 stdenv.mkDerivation (finalAttrs: { 22 pname = "mqtt-to-influxdb"; 23 version = "0.2.1"; 24 25 __structuredAttrs = true; 26 27 src = fetchFromGitHub { 28 owner = "DavidHamburg"; 29 repo = "mqtt-to-influxdb"; 30 tag = "v${finalAttrs.version}"; 31 hash = "sha256-rTMI9gqjtrmtT9SoYcHHq19Jch1dH7/tmyqz5F4f9Ao="; 32 fetchSubmodules = true; 33 }; 34 35 postPatch = '' 36 substituteInPlace src/app/CMakeLists.txt \ 37 --replace-fail "/usr" "$out" 38 sed -i '1i #include <iostream>' src/app-validate/main.cpp 39 substituteInPlace src/app-validate/main.cpp \ 40 --replace-fail "OptionParseException" "exceptions::parsing" 41 substituteInPlace src/app/main.cpp \ 42 --replace-fail "OptionParseException" "exceptions::parsing" 43 substituteInPlace src/libmqtt-to-influxdb/database/iotrepository.cpp \ 44 --replace-fail "InfluxDB.h" "InfluxDB/InfluxDB.h" \ 45 --replace-fail "InfluxDBFactory.h" "InfluxDB/InfluxDBFactory.h" 46 '' 47 + lib.optionalString stdenv.cc.isClang '' 48 substituteInPlace src/libmqtt-to-influxdb/CMakeLists.txt \ 49 --replace-fail "stdc++fs" "" 50 ''; 51 52 nativeBuildInputs = [ cmake ]; 53 54 buildInputs = [ 55 spdlog 56 yaml-cpp 57 libcpr 58 cxxopts 59 nlohmann_json 60 influxdb-cxx 61 boost188 62 curl 63 paho-mqtt-cpp 64 paho-mqtt-c 65 stduuid 66 microsoft-gsl 67 catch2 68 ]; 69 70 meta = { 71 description = "MQTT message parser for writing statistics into InfluxDB"; 72 homepage = "https://github.com/DavidHamburg/mqtt-to-influxdb"; 73 license = lib.licenses.mit; 74 maintainers = [ lib.maintainers.sikmir ]; 75 platforms = lib.platforms.unix; 76 }; 77 })
