Merge pull request #55422 from nand0p/ethminer

ethminer: init at 0.18.0-rc.0
This commit is contained in:
Silvan Mosberger 2019-05-02 01:29:09 +02:00 committed by GitHub
commit b6a6162919
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 281 additions and 7 deletions

View File

@ -395,6 +395,7 @@
./services/misc/emby.nix
./services/misc/errbot.nix
./services/misc/etcd.nix
./services/misc/ethminer.nix
./services/misc/exhibitor.nix
./services/misc/felix.nix
./services/misc/folding-at-home.nix

View File

@ -0,0 +1,115 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.ethminer;
poolUrl = escapeShellArg "stratum1+tcp://${cfg.wallet}@${cfg.pool}:${toString cfg.stratumPort}/${cfg.rig}/${cfg.registerMail}";
in
{
###### interface
options = {
services.ethminer = {
enable = mkOption {
type = types.bool;
default = false;
description = "Enable ethminer ether mining.";
};
recheckInterval = mkOption {
type = types.int;
default = 2000;
description = "Interval in milliseconds between farm rechecks.";
};
toolkit = mkOption {
type = types.enum [ "cuda" "opencl" ];
default = "cuda";
description = "Cuda or opencl toolkit.";
};
apiPort = mkOption {
type = types.int;
default = -3333;
description = "Ethminer api port. minus sign puts api in read-only mode.";
};
wallet = mkOption {
type = types.str;
example = "0x0123456789abcdef0123456789abcdef01234567";
description = "Ethereum wallet address.";
};
pool = mkOption {
type = types.str;
example = "eth-us-east1.nanopool.org";
description = "Mining pool address.";
};
stratumPort = mkOption {
type = types.port;
default = 9999;
description = "Stratum protocol tcp port.";
};
rig = mkOption {
type = types.str;
default = "mining-rig-name";
description = "Mining rig name.";
};
registerMail = mkOption {
type = types.str;
example = "email%40example.org";
description = "Url encoded email address to register with pool.";
};
maxPower = mkOption {
type = types.int;
default = 115;
description = "Miner max watt usage.";
};
};
};
###### implementation
config = mkIf cfg.enable {
systemd.services.ethminer = {
path = [ pkgs.cudatoolkit ];
description = "ethminer ethereum mining service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
DynamicUser = true;
ExecStartPost = optional (cfg.toolkit == "cuda") "+${getBin config.boot.kernelPackages.nvidia_x11}/bin/nvidia-smi -pl ${toString cfg.maxPower}";
};
environment = {
LD_LIBRARY_PATH = "${config.boot.kernelPackages.nvidia_x11}/lib";
};
script = ''
${pkgs.ethminer}/bin/.ethminer-wrapped \
--farm-recheck ${toString cfg.recheckInterval} \
--report-hashrate \
--${cfg.toolkit} \
--api-port ${toString cfg.apiPort} \
--pool ${poolUrl}
'';
};
};
}

View File

@ -0,0 +1,58 @@
{ stdenv, fetchFromGitHub, cmake, boost, cryptopp, opencl-headers, opencl-info,
openmpi, ocl-icd, mesa, gbenchmark, gtest }:
stdenv.mkDerivation rec {
pname = "ethash";
version = "0.4.2";
src =
fetchFromGitHub {
owner = "chfast";
repo = "ethash";
rev = "v${version}";
sha256 = "0qiixvxbpl2gz7jh1qs8lmyk7wzv6ffnl7kckqgrpgm547nnn8zy";
};
nativeBuildInputs = [
cmake
];
buildInputs = [
boost
cryptopp
opencl-headers
opencl-info
openmpi
ocl-icd
mesa
];
checkInputs = [
gbenchmark
gtest
];
#preConfigure = ''
# sed -i 's/GTest::main//' test/unittests/CMakeLists.txt
# cat test/unittests/CMakeLists.txt
# ln -sfv ${gtest.src}/googletest gtest
#'';
# NOTE: disabling tests due to gtest issue
cmakeFlags = [
"-DHUNTER_ENABLED=OFF"
"-DETHASH_BUILD_TESTS=OFF"
#"-Dbenchmark_DIR=${gbenchmark}/lib/cmake/benchmark"
#"-DGTest_DIR=${gtest.dev}/lib/cmake/GTest"
#"-DGTest_DIR=${gtest.src}/googletest"
#"-DCMAKE_PREFIX_PATH=${gtest.dev}/lib/cmake"
];
meta = with stdenv.lib; {
description = "PoW algorithm for Ethereum 1.0 based on Dagger-Hashimoto";
homepage = https://github.com/ethereum/ethash;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ nand0p ];
license = licenses.asl20;
};
}

View File

@ -1,10 +1,7 @@
{ stdenv
, fetchFromGitHub
, cmake
, python
}:
{ stdenv , fetchFromGitHub , cmake , python }:
stdenv.mkDerivation rec {
name = "jsoncpp-${version}";
pname = "jsoncpp";
version = "1.8.4";
src = fetchFromGitHub {
@ -36,13 +33,14 @@ stdenv.mkDerivation rec {
cmakeFlags = [
"-DBUILD_SHARED_LIBS=ON"
"-DBUILD_STATIC_LIBS=OFF"
"-DJSONCPP_WITH_CMAKE_PACKAGE=ON"
];
meta = with stdenv.lib; {
inherit version;
homepage = https://github.com/open-source-parsers/jsoncpp;
description = "A C++ library for interacting with JSON.";
maintainers = with maintainers; [ ttuegel cpages ];
maintainers = with maintainers; [ ttuegel cpages nand0p ];
license = licenses.mit;
platforms = platforms.all;
};

View File

@ -0,0 +1,35 @@
{ stdenv, fetchFromGitHub, cmake, gtest, python, boost }:
stdenv.mkDerivation rec {
pname = "cli11";
version = "1.7.1";
src = fetchFromGitHub {
owner = "CLIUtils";
repo = "CLI11";
rev = "v${version}";
sha256 = "0wddck970pczk7c201i2g6s85mkv4f2f4zxy6mndh3pfz41wcs2d";
};
nativeBuildInputs = [ cmake ];
checkInputs = [ boost python ];
doCheck = true;
preConfigure = ''
rm -rfv extern/googletest
ln -sfv ${gtest.src} extern/googletest
'';
enableParallelBuilding = true;
meta = with stdenv.lib; {
description = "CLI11 is a command line parser for C++11";
homepage = https://github.com/CLIUtils/CLI11;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ nand0p ];
license = licenses.unfreeRedistributable;
};
}

View File

@ -0,0 +1,61 @@
{ stdenv, fetchFromGitHub, opencl-headers, cmake, jsoncpp, boost, makeWrapper,
cudatoolkit, mesa, ethash, opencl-info, ocl-icd, openssl, pkg-config, cli11 }:
stdenv.mkDerivation rec {
pname = "ethminer";
version = "0.18.0-rc.0";
src =
fetchFromGitHub {
owner = "ethereum-mining";
repo = "ethminer";
rev = "v${version}";
sha256 = "0gwnwxahjfwr4d2aci7y3w206nc5ifssl28ildva98ys0d24wy7z";
fetchSubmodules = true;
};
# NOTE: dbus is broken
cmakeFlags = [
"-DHUNTER_ENABLED=OFF"
"-DETHASHCUDA=ON"
"-DAPICORE=ON"
"-DETHDBUS=OFF"
"-DCMAKE_BUILD_TYPE=Release"
];
nativeBuildInputs = [
cmake
pkg-config
makeWrapper
];
buildInputs = [
cli11
boost
opencl-headers
mesa
cudatoolkit
ethash
opencl-info
ocl-icd
openssl
jsoncpp
];
preConfigure = ''
sed -i 's/_lib_static//' libpoolprotocols/CMakeLists.txt
'';
postInstall = ''
wrapProgram $out/bin/ethminer --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib
'';
meta = with stdenv.lib; {
description = "Ethereum miner with OpenCL, CUDA and stratum support";
homepage = https://github.com/ethereum-mining/ethminer;
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ nand0p ];
license = licenses.gpl2;
};
}

View File

@ -2103,10 +2103,14 @@ in
colormake = callPackage ../development/tools/build-managers/colormake { };
ethash = callPackage ../development/libraries/ethash { };
cpuminer = callPackage ../tools/misc/cpuminer { };
cpuminer-multi = callPackage ../tools/misc/cpuminer-multi { };
ethminer = callPackage ../tools/misc/ethminer { };
cuetools = callPackage ../tools/cd-dvd/cuetools { };
u3-tool = callPackage ../tools/filesystems/u3-tool { };
@ -8886,6 +8890,8 @@ in
libsigrok4dsl = callPackage ../applications/science/electronics/dsview/libsigrok4dsl.nix { };
libsigrokdecode4dsl = callPackage ../applications/science/electronics/dsview/libsigrokdecode4dsl.nix { };
cli11 = callPackage ../development/tools/misc/cli11 { };
dcadec = callPackage ../development/tools/dcadec { };
dejagnu = callPackage ../development/tools/misc/dejagnu { };