Unverified Commit b207e664 authored by Weijia Wang's avatar Weijia Wang Committed by GitHub
Browse files

Merge pull request #215444 from wegank/xmrig-darwin

xmrig: add darwin support
parents e3ba9483 4c4184ef
Loading
Loading
Loading
Loading
+40 −9
Original line number Diff line number Diff line
{ 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 ];
  };
}
+1 −1
Original line number Diff line number Diff line
@@ -31306,7 +31306,7 @@ with pkgs;
  xmr-stak = callPackage ../applications/misc/xmr-stak { };
  xmrig = callPackage ../applications/misc/xmrig { };
  xmrig = darwin.apple_sdk_11_0.callPackage ../applications/misc/xmrig { };
  xmrig-mo = callPackage ../applications/misc/xmrig/moneroocean.nix { };