nixpkgs/pkgs/by-name/xm/xmrig/package.nix
2025-06-25 15:59:01 +00:00

67 lines
1.2 KiB
Nix

{
stdenv,
lib,
fetchFromGitHub,
cmake,
libuv,
libmicrohttpd,
openssl,
hwloc,
donateLevel ? 0,
}:
stdenv.mkDerivation rec {
pname = "xmrig";
version = "6.24.0";
src = fetchFromGitHub {
owner = "xmrig";
repo = "xmrig";
rev = "v${version}";
hash = "sha256-AbiTInOMHZ/YOUyl8IMU62ETZtbSTUqaP4vCJKAOCYM=";
};
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
];
inherit donateLevel;
installPhase = ''
runHook preInstall
install -vD xmrig $out/bin/xmrig
runHook postInstall
'';
# https://github.com/NixOS/nixpkgs/issues/245534
hardeningDisable = [ "fortify" ];
meta = with lib; {
description = "Monero (XMR) CPU miner";
homepage = "https://github.com/xmrig/xmrig";
license = licenses.gpl3Plus;
mainProgram = "xmrig";
platforms = platforms.unix;
maintainers = with maintainers; [ kim0 ];
};
}