2023-02-09 11:40:11 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, cmake
|
|
|
|
, libuv
|
|
|
|
, libmicrohttpd
|
|
|
|
, openssl
|
|
|
|
, hwloc
|
2020-04-24 23:36:52 +00:00
|
|
|
, donateLevel ? 0
|
2023-02-09 11:40:11 +00:00
|
|
|
, darwin
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
let
|
|
|
|
inherit (darwin.apple_sdk_11_0.frameworks) Carbon CoreServices OpenCL;
|
|
|
|
in
|
2020-04-24 23:36:52 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "xmrig";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "6.21.0";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "xmrig";
|
|
|
|
repo = "xmrig";
|
|
|
|
rev = "v${version}";
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-7OHfFo8+MUNSI3vpOIODKQH41jmraHDJOyqfLBp/v9o=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
patches = [
|
|
|
|
./donate-level.patch
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
2021-06-04 09:07:49 +00:00
|
|
|
substituteAllInPlace src/donate.h
|
2023-02-09 11:40:11 +00:00
|
|
|
substituteInPlace cmake/OpenSSL.cmake \
|
|
|
|
--replace "set(OPENSSL_USE_STATIC_LIBS TRUE)" "set(OPENSSL_USE_STATIC_LIBS FALSE)"
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-02-09 11:40:11 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
cmake
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
libuv
|
|
|
|
libmicrohttpd
|
|
|
|
openssl
|
|
|
|
hwloc
|
|
|
|
] ++ lib.optionals stdenv.isDarwin [
|
|
|
|
Carbon
|
|
|
|
CoreServices
|
|
|
|
OpenCL
|
|
|
|
];
|
|
|
|
|
|
|
|
inherit donateLevel;
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
installPhase = ''
|
2023-02-09 11:40:11 +00:00
|
|
|
runHook preInstall
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
install -vD xmrig $out/bin/xmrig
|
2023-02-09 11:40:11 +00:00
|
|
|
|
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
# https://github.com/NixOS/nixpkgs/issues/245534
|
|
|
|
hardeningDisable = [ "fortify" ];
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Monero (XMR) CPU miner";
|
|
|
|
homepage = "https://github.com/xmrig/xmrig";
|
|
|
|
license = licenses.gpl3Plus;
|
2023-11-16 04:20:00 +00:00
|
|
|
mainProgram = "xmrig";
|
2023-02-09 11:40:11 +00:00
|
|
|
platforms = platforms.unix;
|
2022-08-12 12:06:08 +00:00
|
|
|
maintainers = with maintainers; [ kim0 ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|