From 4c4184ef92a17f0f946b4d2b96a400f4a70e0655 Mon Sep 17 00:00:00 2001 From: Weijia Wang <9713184+wegank@users.noreply.github.com> Date: Thu, 9 Feb 2023 06:51:55 +0100 Subject: xmrig: add darwin support --- pkgs/applications/misc/xmrig/default.nix | 49 ++++++++++++++++++++++++++------ 1 file changed, 40 insertions(+), 9 deletions(-) (limited to 'pkgs/applications/misc/xmrig/default.nix') diff --git a/pkgs/applications/misc/xmrig/default.nix b/pkgs/applications/misc/xmrig/default.nix index 4917fe7ab54..05f5b313902 100644 --- a/pkgs/applications/misc/xmrig/default.nix +++ b/pkgs/applications/misc/xmrig/default.nix @@ -1,7 +1,18 @@ -{ stdenv, lib, fetchFromGitHub, cmake, libuv, libmicrohttpd, openssl, hwloc +{ stdenv +, lib +, fetchFromGitHub +, cmake +, libuv +, libmicrohttpd +, openssl +, hwloc , donateLevel ? 0 +, darwin }: +let + inherit (darwin.apple_sdk_11_0.frameworks) Carbon CoreServices OpenCL; +in stdenv.mkDerivation rec { pname = "xmrig"; version = "6.19.0"; @@ -10,29 +21,49 @@ stdenv.mkDerivation rec { owner = "xmrig"; repo = "xmrig"; rev = "v${version}"; - sha256 = "sha256-pMI5SqAa9jauwWvc3JpyWQa+pQvntbTrta1p0qjBaoM="; + hash = "sha256-pMI5SqAa9jauwWvc3JpyWQa+pQvntbTrta1p0qjBaoM="; }; - nativeBuildInputs = [ cmake ]; - buildInputs = [ libuv libmicrohttpd openssl hwloc ]; + patches = [ + ./donate-level.patch + ]; - inherit donateLevel; - - patches = [ ./donate-level.patch ]; postPatch = '' substituteAllInPlace src/donate.h + substituteInPlace cmake/OpenSSL.cmake \ + --replace "set(OPENSSL_USE_STATIC_LIBS TRUE)" "set(OPENSSL_USE_STATIC_LIBS FALSE)" ''; + nativeBuildInputs = [ + cmake + ]; + + buildInputs = [ + libuv + libmicrohttpd + openssl + hwloc + ] ++ lib.optionals stdenv.isDarwin [ + Carbon + CoreServices + OpenCL + ]; + + inherit donateLevel; + installPhase = '' + runHook preInstall + install -vD xmrig $out/bin/xmrig + + runHook postInstall ''; meta = with lib; { - broken = stdenv.isDarwin; description = "Monero (XMR) CPU miner"; homepage = "https://github.com/xmrig/xmrig"; license = licenses.gpl3Plus; - platforms = [ "x86_64-linux" "x86_64-darwin" ]; + platforms = platforms.unix; maintainers = with maintainers; [ kim0 ]; }; } -- cgit 1.4.1