1{ stdenv
2, lib
3, fetchFromGitHub
4, cmake
5, libuv
6, libmicrohttpd
7, openssl
8, darwin
9}:
10
11let
12 inherit (darwin.apple_sdk_11_0.frameworks) CoreServices IOKit;
13in
14stdenv.mkDerivation rec {
15 pname = "xmrig-proxy";
16 version = "6.19.2";
17
18 src = fetchFromGitHub {
19 owner = "xmrig";
20 repo = "xmrig-proxy";
21 rev = "v${version}";
22 hash = "sha256-3nEfg2hmOMjevo5VhjelIeV2xRwkIOVhLNxBmPzdWog=";
23 };
24
25 postPatch = ''
26 # Link dynamically against libraries instead of statically
27 substituteInPlace CMakeLists.txt \
28 --replace uuid.a uuid
29 substituteInPlace cmake/OpenSSL.cmake \
30 --replace "set(OPENSSL_USE_STATIC_LIBS TRUE)" "set(OPENSSL_USE_STATIC_LIBS FALSE)"
31 '';
32
33 nativeBuildInputs = [
34 cmake
35 ];
36
37 buildInputs = [
38 libuv
39 libmicrohttpd
40 openssl
41 ] ++ lib.optionals stdenv.isDarwin [
42 CoreServices
43 IOKit
44 ];
45
46 installPhase = ''
47 runHook preInstall
48
49 install -vD xmrig-proxy $out/bin/xmrig-proxy
50
51 runHook postInstall
52 '';
53
54 meta = with lib; {
55 description = "Monero (XMR) Stratum protocol proxy";
56 homepage = "https://github.com/xmrig/xmrig-proxy";
57 license = licenses.gpl3Plus;
58 maintainers = with maintainers; [ aij ];
59 };
60}