2020-12-13 07:43:09 +03:00
|
|
|
{ stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
|
|
|
, dotnetPackages
|
|
|
|
, dotnetCorePackages
|
|
|
|
, openssl
|
|
|
|
, boost
|
|
|
|
, libsodium
|
|
|
|
, pkgconfig
|
|
|
|
, zeromq
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
deps = import ./deps.nix { inherit fetchurl; };
|
|
|
|
|
|
|
|
dotnet-sdk = dotnetCorePackages.sdk_3_1;
|
|
|
|
Nuget = dotnetPackages.Nuget;
|
|
|
|
|
|
|
|
nugetSource = stdenv.mkDerivation {
|
|
|
|
pname = "${pname}-nuget-deps";
|
|
|
|
inherit version;
|
|
|
|
|
|
|
|
dontUnpack = true;
|
|
|
|
dontInstall = true;
|
|
|
|
|
|
|
|
nativeBuildInputs = [ Nuget ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
mkdir -p $out/lib
|
|
|
|
|
|
|
|
nuget sources Disable -Name "nuget.org"
|
|
|
|
for package in ${toString deps}; do
|
|
|
|
nuget add $package -Source $out/lib
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
pname = "miningcore";
|
|
|
|
version = "50";
|
|
|
|
|
|
|
|
projectName = "Miningcore";
|
|
|
|
projectConfiguration = "Release";
|
|
|
|
projectRuntime = "linux-x64";
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
inherit pname version;
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "akshaynexus";
|
|
|
|
repo = "miningcore";
|
|
|
|
rev = "318c0c26a8f0fd7fd7588fb6845abacf6fc27c79";
|
|
|
|
hash = "sha256-TZrhNE/5XUxAirAXRnAZax4OBOeWQlwNkiackXuJ7bI=";
|
|
|
|
};
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
boost
|
|
|
|
libsodium
|
|
|
|
openssl
|
|
|
|
Nuget
|
|
|
|
dotnet-sdk
|
|
|
|
makeWrapper
|
|
|
|
pkgconfig
|
|
|
|
zeromq
|
|
|
|
];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
export HOME=$(mktemp -d)
|
|
|
|
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
|
|
|
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
|
|
|
export DOTNET_ROOT="${dotnet-sdk}/bin"
|
|
|
|
|
|
|
|
nuget sources Disable -Name "nuget.org"
|
|
|
|
|
|
|
|
dotnet restore \
|
|
|
|
--source ${nugetSource}/lib \
|
|
|
|
src/${projectName}
|
|
|
|
|
2020-12-14 10:40:46 +03:00
|
|
|
dotnet build \
|
2020-12-13 07:43:09 +03:00
|
|
|
--no-restore \
|
|
|
|
--configuration ${projectConfiguration} \
|
|
|
|
src/${projectName}
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
2020-12-14 10:40:46 +03:00
|
|
|
dotnet publish --no-restore -o $out/lib -c Release src/${projectName}
|
|
|
|
makeWrapper $out/lib/${projectName} $out/bin/${pname} \
|
|
|
|
--set DOTNET_ROOT "${dotnet-sdk}" \
|
2020-12-13 07:43:09 +03:00
|
|
|
--run "cd $out/lib"
|
|
|
|
'';
|
|
|
|
|
|
|
|
# If we don't disable stripping the executable fails to start with segfault
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
meta = with stdenv.lib; {
|
|
|
|
description = "A high-performance Mining-Pool Engine";
|
|
|
|
homepage = "https://github.com/akshaynexus/miningcore";
|
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ nrdxp ];
|
2020-12-28 07:07:40 +03:00
|
|
|
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
|
2020-12-13 07:43:09 +03:00
|
|
|
};
|
|
|
|
}
|