2020-09-25 04:45:31 +00:00
|
|
|
{ lib, stdenv, fetchFromGitHub, fetchurl, linkFarmFromDrvs, makeWrapper,
|
2021-07-21 07:28:18 +00:00
|
|
|
dotnetPackages, dotnetCorePackages, altcoinSupport ? false
|
2020-09-25 04:45:31 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
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 = "btcpayserver";
|
2021-09-18 10:52:07 +00:00
|
|
|
version = "1.2.3";
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = pname;
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-09-18 10:52:07 +00:00
|
|
|
sha256 = "sha256-6ktlnbYb+pOXwl52QmnqDsPlXaiF1ghjQg1yfznulqo=";
|
2020-09-25 04:45:31 +00:00
|
|
|
};
|
|
|
|
|
2020-12-03 08:41:04 +00:00
|
|
|
nativeBuildInputs = [ dotnetSdk dotnetPackages.Nuget makeWrapper ];
|
2020-09-25 04:45:31 +00:00
|
|
|
|
|
|
|
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
|
|
|
|
|
2021-07-21 07:28:18 +00:00
|
|
|
dotnet restore --source $TMP/nuget ${lib.optionalString altcoinSupport ''/p:Configuration="Altcoins-Release"''} BTCPayServer/BTCPayServer.csproj
|
|
|
|
dotnet publish --no-restore --output $out/share/$pname ${lib.optionalString altcoinSupport "-c Altcoins-Release"} BTCPayServer/BTCPayServer.csproj
|
2020-09-25 04:45:31 +00:00
|
|
|
'';
|
|
|
|
|
2020-12-03 08:41:04 +00:00
|
|
|
# btcpayserver requires the publish directory as its working dir
|
|
|
|
# https://github.com/btcpayserver/btcpayserver/issues/1894
|
2020-09-25 04:45:31 +00:00
|
|
|
installPhase = ''
|
2020-12-03 08:41:04 +00:00
|
|
|
makeWrapper $out/share/$pname/BTCPayServer $out/bin/$pname \
|
|
|
|
--set DOTNET_ROOT "${dotnetSdk}" \
|
|
|
|
--run "cd $out/share/$pname"
|
2020-09-25 04:45:31 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Self-hosted, open-source cryptocurrency payment processor";
|
|
|
|
homepage = "https://btcpayserver.org";
|
|
|
|
maintainers = with maintainers; [ kcalvinalvin earvstedt ];
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
platforms = lib.platforms.linux;
|
|
|
|
};
|
|
|
|
}
|