btcpayserver: use buildDotnetModule
This commit is contained in:
parent
e8b4515f39
commit
a5e3a7e16c
1 changed files with 15 additions and 33 deletions
|
@ -1,19 +1,7 @@
|
||||||
{ lib, stdenv, fetchFromGitHub, fetchurl, linkFarmFromDrvs, makeWrapper,
|
{ lib, buildDotnetModule, fetchFromGitHub, dotnetCorePackages
|
||||||
dotnetPackages, dotnetCorePackages, altcoinSupport ? false
|
, altcoinSupport ? false }:
|
||||||
}:
|
|
||||||
|
|
||||||
let
|
buildDotnetModule rec {
|
||||||
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";
|
pname = "btcpayserver";
|
||||||
version = "1.2.4";
|
version = "1.2.4";
|
||||||
|
|
||||||
|
@ -24,35 +12,29 @@ stdenv.mkDerivation rec {
|
||||||
sha256 = "sha256-vjNJ08twsJ036TTFF6srOGshDpP7ZwWCGN0XjrtFT/g=";
|
sha256 = "sha256-vjNJ08twsJ036TTFF6srOGshDpP7ZwWCGN0XjrtFT/g=";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [ dotnetSdk dotnetPackages.Nuget makeWrapper ];
|
projectFile = "BTCPayServer/BTCPayServer.csproj";
|
||||||
|
nugetDeps = ./deps.nix;
|
||||||
|
|
||||||
buildPhase = ''
|
dotnet-sdk = dotnetCorePackages.sdk_3_1;
|
||||||
export HOME=$TMP/home
|
dotnet-runtime = dotnetCorePackages.aspnetcore_3_1;
|
||||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
|
||||||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
|
||||||
|
|
||||||
nuget sources Add -Name tmpsrc -Source $TMP/nuget
|
dotnetFlags = lib.optionals altcoinSupport [ "/p:Configuration=Altcoins-Release" ];
|
||||||
nuget init ${linkFarmFromDrvs "deps" deps} $TMP/nuget
|
|
||||||
|
|
||||||
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
|
|
||||||
'';
|
|
||||||
|
|
||||||
# btcpayserver requires the publish directory as its working dir
|
# btcpayserver requires the publish directory as its working dir
|
||||||
# https://github.com/btcpayserver/btcpayserver/issues/1894
|
# https://github.com/btcpayserver/btcpayserver/issues/1894
|
||||||
installPhase = ''
|
preInstall = ''
|
||||||
makeWrapper $out/share/$pname/BTCPayServer $out/bin/$pname \
|
makeWrapperArgs+=(--run "cd $out/lib/btcpayserver")
|
||||||
--set DOTNET_ROOT "${dotnetSdk}" \
|
|
||||||
--run "cd $out/share/$pname"
|
|
||||||
'';
|
'';
|
||||||
|
|
||||||
dontStrip = true;
|
postInstall = ''
|
||||||
|
mv $out/bin/{BTCPayServer,btcpayserver}
|
||||||
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Self-hosted, open-source cryptocurrency payment processor";
|
description = "Self-hosted, open-source cryptocurrency payment processor";
|
||||||
homepage = "https://btcpayserver.org";
|
homepage = "https://btcpayserver.org";
|
||||||
maintainers = with maintainers; [ kcalvinalvin earvstedt ];
|
maintainers = with maintainers; [ kcalvinalvin earvstedt ];
|
||||||
license = lib.licenses.mit;
|
license = licenses.mit;
|
||||||
platforms = lib.platforms.linux;
|
platforms = platforms.linux;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue