lxl66566 a2da4cab4b xmrig: patch modprobe path
Signed-off-by: lxl66566 <lxl66566@gmail.com>
2025-07-28 12:25:38 +08:00

72 lines
1.3 KiB
Nix

{
stdenv,
lib,
fetchFromGitHub,
cmake,
libuv,
libmicrohttpd,
openssl,
hwloc,
kmod,
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)"
''
+ lib.optionalString stdenv.hostPlatform.isLinux ''
substituteInPlace src/hw/msr/Msr_linux.cpp \
--replace "/sbin/modprobe" "${kmod}/bin/modprobe"
'';
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 ];
};
}