nixpkgs-suyu/pkgs/applications/blockchains/nbxplorer/default.nix
2020-12-01 23:13:18 -08:00

54 lines
1.5 KiB
Nix

{ lib, stdenv, fetchFromGitHub, fetchurl, linkFarmFromDrvs, makeWrapper,
dotnetPackages, dotnetCorePackages
}:
let
deps = import ./deps.nix {
fetchNuGet = { name, version, sha256 }: fetchurl {
name = "nuget-${name}-${version}.nupkg";
url = "https://www.nuget.org/api/v2/package/${name}/${version}";
inherit sha256;
};
};
dotnetSdk = dotnetCorePackages.sdk_3_1;
in
stdenv.mkDerivation rec {
pname = "nbxplorer";
version = "2.1.46";
src = fetchFromGitHub {
owner = "dgarage";
repo = "NBXplorer";
rev = "v${version}";
sha256 = "1aph7yiwmch7s7x1qkzqv1shs3v6kg8i2s7266la0yp9ksf3w35p";
};
nativeBuildInputs = [ dotnetSdk dotnetPackages.Nuget makeWrapper ];
buildPhase = ''
export HOME=$TMP/home
export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
nuget sources Add -Name tmpsrc -Source $TMP/nuget
nuget init ${linkFarmFromDrvs "deps" deps} $TMP/nuget
dotnet restore --source $TMP/nuget NBXplorer/NBXplorer.csproj
dotnet publish --no-restore --output $out/share/$pname -c Release NBXplorer/NBXplorer.csproj
'';
installPhase = ''
makeWrapper $out/share/$pname/NBXplorer $out/bin/$pname \
--set DOTNET_ROOT "${dotnetSdk}"
'';
dontStrip = true;
meta = with lib; {
description = "Minimalist UTXO tracker for HD Cryptocurrency Wallets";
maintainers = with maintainers; [ kcalvinalvin earvstedt ];
license = lib.licenses.mit;
platforms = lib.platforms.linux;
};
}