Skip to content

Commit 2f55d6f

Browse files
kcalvinalvinerikarvstedt
authored andcommitted
btcpayserver: init at 1.0.5.4
1 parent 2724f7b commit 2f55d6f

4 files changed

Lines changed: 2011 additions & 0 deletions

File tree

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{ lib, stdenv, fetchFromGitHub, fetchurl, linkFarmFromDrvs, makeWrapper,
2+
dotnetPackages, dotnetCorePackages, writeScript, bash
3+
}:
4+
5+
let
6+
deps = import ./deps.nix {
7+
fetchNuGet = { name, version, sha256 }: fetchurl {
8+
name = "nuget-${name}-${version}.nupkg";
9+
url = "https://www.nuget.org/api/v2/package/${name}/${version}";
10+
inherit sha256;
11+
};
12+
};
13+
dotnetSdk = dotnetCorePackages.sdk_3_1;
14+
in
15+
16+
stdenv.mkDerivation rec {
17+
pname = "btcpayserver";
18+
version = "1.0.5.5";
19+
20+
src = fetchFromGitHub {
21+
owner = pname;
22+
repo = pname;
23+
rev = "v${version}";
24+
sha256 = "11h1nrmb7f44msbhhiz9ddqh5ss2kz6d8ysnvd070x3xj5krgnxz";
25+
};
26+
27+
nativeBuildInputs = [ dotnetSdk dotnetPackages.Nuget ];
28+
29+
# Due to a bug in btcpayserver, we can't just `dotnet publish` to create a binary.
30+
# Build with `dotnet build` instead and add a custom `dotnet run` script.
31+
buildPhase = ''
32+
export HOME=$TMP/home
33+
export DOTNET_CLI_TELEMETRY_OPTOUT=1
34+
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
35+
36+
nuget sources Add -Name tmpsrc -Source $TMP/nuget
37+
nuget init ${linkFarmFromDrvs "deps" deps} $TMP/nuget
38+
39+
dotnet restore --source $TMP/nuget BTCPayServer/BTCPayServer.csproj
40+
dotnet build -c Release BTCPayServer/BTCPayServer.csproj
41+
'';
42+
43+
runScript = ''
44+
#!${bash}/bin/bash
45+
DOTNET_CLI_TELEMETRY_OPTOUT=1 exec ${dotnetSdk}/bin/dotnet run --no-launch-profile --no-build \
46+
-c Release -p @@SHARE@@/BTCPayServer/BTCPayServer.csproj -- "$@"
47+
'';
48+
49+
installPhase = ''
50+
cd ..
51+
share=$out/share/$pname
52+
mkdir -p $share
53+
mv -T source $share
54+
install -D -m500 <(echo "$runScript" | sed "s|@@SHARE@@|$share|") $out/bin/$pname
55+
'';
56+
57+
dontStrip = true;
58+
59+
meta = with lib; {
60+
description = "Self-hosted, open-source cryptocurrency payment processor";
61+
homepage = "https://btcpayserver.org";
62+
maintainers = with maintainers; [ kcalvinalvin earvstedt ];
63+
license = lib.licenses.mit;
64+
platforms = lib.platforms.linux;
65+
};
66+
}

0 commit comments

Comments
 (0)