working on ethminer

feature/hass
Ingolf Wagner 2021-05-02 05:11:07 +02:00
parent 3de9f8a0e8
commit 08ec3c079d
Signed by: palo
GPG Key ID: 76BF5F1928B9618B
6 changed files with 126 additions and 1 deletions

View File

@ -30,6 +30,7 @@
./mysql.nix
./property.nix
./finance.nix
#./mining.nix
];
nixpkgs.config.permittedInsecurePackages =

View File

@ -0,0 +1,57 @@
{ pkgs, config, ... }:
let
maxPower = 90;
pool = "eu1.ethermine.org";
toolkit = "opencl";
wallet = "";
rig = config.networking.hostName;
recheckInterval = 2000;
package = pkgs.ethminer;
in {
systemd.services.ethminer = {
description = "ethminer ethereum mining service";
wantedBy = [ "multi-user.target" ];
after = [ "network.target" ];
serviceConfig = {
DynamicUser = true;
ExecStartPre = "${package}/bin/.ethminer-wrapped --list-devices";
Restart = "always";
};
script = ''
${package}/bin/.ethminer-wrapped \
--farm-recheck ${toString recheckInterval} \
--report-hashrate \
--${toolkit} \
--pool stratum1+tcp://${wallet}.${rig}@${pool}:4444
'';
};
#nixpkgs.config.allowBroken = true;
hardware.opengl = {
enable = true;
extraPackages = with pkgs; [
vaapiIntel
libvdpau-va-gl
vaapiVdpau
intel-ocl
];
driSupport = true;
driSupport32Bit = true;
};
environment.systemPackages = with pkgs; [
package
# go-ethereum
go-ethereum
# to check opencl config
clinfo
# check temperature
i7z
];
}

View File

@ -24,7 +24,6 @@
midori
paperkey
gnupg
#haskellPackages.hopenpgp-tools
ctmg
];

View File

@ -65,4 +65,6 @@ in {
sha256 = "04j6gcb6ayrcf7rxr0bkgd48zppiryhdyv7mvp0q12ngdkf2yagd";
}) { };
ethminer = callPackage ./ethminer { cudaSupport = false; };
}

64
pkgs/ethminer/default.nix Normal file
View File

@ -0,0 +1,64 @@
{ lib, stdenv, clangStdenv, fetchFromGitHub, opencl-headers, cmake, jsoncpp
, boost, makeWrapper, cudatoolkit, cudaSupport, mesa, ethash, opencl-info
, ocl-icd, openssl, pkg-config, cli11 }@args:
# Note that this requires clang < 9.0 to build, and currently
# clangStdenv provides clang 7.1 which satisfies the requirement.
let stdenv = if cudaSupport then clangStdenv else args.stdenv;
in stdenv.mkDerivation rec {
pname = "ethminer";
version = "0.19.0";
src = fetchFromGitHub {
owner = "ethereum-mining";
repo = "ethminer";
rev = "v${version}";
sha256 = "1kyff3vx2r4hjpqah9qk99z6dwz7nsnbnhhl6a76mdhjmgp1q646";
fetchSubmodules = true;
};
# NOTE: dbus is broken
cmakeFlags = [
"-DHUNTER_ENABLED=OFF"
"-DETHASHCUDA=ON"
"-DAPICORE=ON"
"-DETHDBUS=OFF"
"-DCMAKE_BUILD_TYPE=Release"
] ++ lib.optionals (!cudaSupport) [
"-DETHASHCUDA=OFF" # on by default
];
nativeBuildInputs = [ cmake pkg-config makeWrapper ];
buildInputs = [
cli11
boost
opencl-headers
mesa
ethash
opencl-info
ocl-icd
openssl
jsoncpp
] ++ lib.optionals cudaSupport [ cudatoolkit ];
preConfigure = ''
sed -i 's/_lib_static//' libpoolprotocols/CMakeLists.txt
'';
postInstall = ''
wrapProgram $out/bin/ethminer --prefix LD_LIBRARY_PATH : /run/opengl-driver/lib
'';
meta = with lib; {
description = "Ethereum miner with OpenCL${
lib.optionalString cudaSupport ", CUDA"
} and stratum support";
homepage = "https://github.com/ethereum-mining/ethminer";
platforms = [ "x86_64-linux" ];
maintainers = with maintainers; [ nand0p atemu ];
license = licenses.gpl3Only;
broken = cudaSupport;
};
}

View File

@ -18,5 +18,7 @@
# config vim
programs.custom.vim.enable = true;
services.locate.enable = true;
}