mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 23:13:19 +00:00
e0464e4788
In preparation for the deprecation of `stdenv.isX`. These shorthands are not conducive to cross-compilation because they hide the platforms. Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way One example of why this is bad and especially affects compiler packages https://www.github.com/NixOS/nixpkgs/pull/343059 There are too many files to go through manually but a treewide should get users thinking when they see a `hostPlatform.isX` in a place where it doesn't make sense. ``` fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is" fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is" fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is" ```
74 lines
1.3 KiB
Nix
74 lines
1.3 KiB
Nix
{ 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.22.0";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "xmrig";
|
|
repo = "xmrig";
|
|
rev = "v${version}";
|
|
hash = "sha256-kFjUAOs92xExCV/ph81TFvgRXC6ZRi1m0G51c4JmeMA=";
|
|
};
|
|
|
|
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.hostPlatform.isDarwin [
|
|
Carbon
|
|
CoreServices
|
|
OpenCL
|
|
];
|
|
|
|
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 ];
|
|
};
|
|
}
|