miningcore: remove broken package
This commit is contained in:
parent
1b80806516
commit
bd50bcbdc2
|
@ -1,96 +0,0 @@
|
|||
#! /usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p dotnet-sdk_3 nixfmt
|
||||
|
||||
# Run this script to generate deps.nix
|
||||
# ./create_deps.sh /path/to/package/source/checkout > deps.nix
|
||||
|
||||
# Attribution: this script is shamelessly stolen and barely modified from
|
||||
# <nixpkgs>/pkgs/applications/blockchains/wasabibackend
|
||||
|
||||
URLBASE="https://www.nuget.org/api/v2/package"
|
||||
|
||||
DEPS_HEADER="
|
||||
{ fetchurl }:
|
||||
let
|
||||
nugetUrlBase = \"$URLBASE\";
|
||||
fetchNuGet = { name, version, sha256 }: fetchurl {
|
||||
inherit sha256;
|
||||
url = \"\${nugetUrlBase}/\${name}/\${version}\";
|
||||
};
|
||||
in ["
|
||||
|
||||
DEPS_FOOTER="]"
|
||||
|
||||
DEPS_TEMPLATE="
|
||||
(fetchNuGet {
|
||||
name = \"%s\";
|
||||
version = \"%s\";
|
||||
sha256 = \"%s\";
|
||||
})"
|
||||
|
||||
|
||||
function generate_restore_log() {
|
||||
checkout_path=$1
|
||||
>&2 echo "generating restore log for $checkout_path..."
|
||||
cd $checkout_path
|
||||
dotnet nuget locals all --clear
|
||||
dotnet restore -v normal --no-cache -r linux-x64
|
||||
cd -
|
||||
}
|
||||
|
||||
function process_restore_log() {
|
||||
restore_log=$1
|
||||
>&2 echo "processing restore log..."
|
||||
while read line; do
|
||||
if echo $line | grep -q "^[[:space:]]*Installing"; then
|
||||
l=$(echo $line | xargs)
|
||||
l=${l#Installing }
|
||||
l=${l%.}
|
||||
echo $l
|
||||
fi
|
||||
done < $restore_log
|
||||
}
|
||||
|
||||
function prefetch_deps() {
|
||||
processed_log=$1
|
||||
>&2 echo "prefetching deps..."
|
||||
while read line; do
|
||||
name=$(echo $line | cut -d' ' -f1)
|
||||
>&2 echo "prefetching '$name' version: $version"
|
||||
version=$(echo $line | cut -d' ' -f2)
|
||||
hash=$(nix-prefetch-url "$URLBASE/$name/$version" 2>/dev/null)
|
||||
echo "$name $version $hash"
|
||||
done < $processed_log
|
||||
}
|
||||
|
||||
function generate_deps_expression() {
|
||||
packages=$1
|
||||
>&2 echo "generating deps nix-expression..."
|
||||
echo $DEPS_HEADER
|
||||
while read line; do
|
||||
name=$(echo $line | cut -d' ' -f1)
|
||||
version=$(echo $line | cut -d' ' -f2)
|
||||
hash=$(echo $line | cut -d' ' -f3)
|
||||
printf "$DEPS_TEMPLATE" $name $version $hash
|
||||
done < $packages
|
||||
echo $DEPS_FOOTER
|
||||
}
|
||||
|
||||
function main() {
|
||||
checkout_path=$1
|
||||
tmpdir=$(mktemp -d)
|
||||
generate_restore_log $checkout_path > $tmpdir/restore.log
|
||||
process_restore_log $tmpdir/restore.log > $tmpdir/processed.log
|
||||
prefetch_deps $tmpdir/processed.log > $tmpdir/prefetched.log
|
||||
generate_deps_expression $tmpdir/prefetched.log > $tmpdir/deps.nix
|
||||
nixfmt $tmpdir/deps.nix
|
||||
cat $tmpdir/deps.nix
|
||||
rm -rf $tmpdir
|
||||
}
|
||||
|
||||
if [ ! -d "$1" ]; then
|
||||
>&2 echo "First argument must be a directory, the path to the package source checkout"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
main $@
|
|
@ -1,104 +0,0 @@
|
|||
{ 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}
|
||||
|
||||
dotnet build \
|
||||
--no-restore \
|
||||
--configuration ${projectConfiguration} \
|
||||
src/${projectName}
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
dotnet publish --no-restore -o $out/lib -c Release src/${projectName}
|
||||
makeWrapper $out/lib/${projectName} $out/bin/${pname} \
|
||||
--set DOTNET_ROOT "${dotnet-sdk}" \
|
||||
--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 ];
|
||||
platforms = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" ];
|
||||
broken = true;
|
||||
};
|
||||
}
|
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue