temp: mirror erikarvstedt btcpayserver
This commit is contained in:
parent
adae7da3f2
commit
99295328b4
66
pkgs/btcpayserver/default.nix
Normal file
66
pkgs/btcpayserver/default.nix
Normal file
@ -0,0 +1,66 @@
|
||||
{ lib, stdenv, fetchFromGitHub, fetchurl, linkFarmFromDrvs, makeWrapper,
|
||||
dotnetPackages, dotnetCorePackages, writeScript, bash
|
||||
}:
|
||||
|
||||
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";
|
||||
version = "1.0.5.5";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = pname;
|
||||
repo = pname;
|
||||
rev = "v${version}";
|
||||
sha256 = "11h1nrmb7f44msbhhiz9ddqh5ss2kz6d8ysnvd070x3xj5krgnxz";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ dotnetSdk dotnetPackages.Nuget ];
|
||||
|
||||
# Due to a bug in btcpayserver, we can't just `dotnet publish` to create a binary.
|
||||
# Build with `dotnet build` instead and add a custom `dotnet run` script.
|
||||
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 BTCPayServer/BTCPayServer.csproj
|
||||
dotnet build -c Release BTCPayServer/BTCPayServer.csproj
|
||||
'';
|
||||
|
||||
runScript = ''
|
||||
#!${bash}/bin/bash
|
||||
DOTNET_CLI_TELEMETRY_OPTOUT=1 exec ${dotnetSdk}/bin/dotnet run --no-launch-profile --no-build \
|
||||
-c Release -p @@SHARE@@/BTCPayServer/BTCPayServer.csproj -- "$@"
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
cd ..
|
||||
share=$out/share/$pname
|
||||
mkdir -p $share
|
||||
mv -T source $share
|
||||
install -D -m500 <(echo "$runScript" | sed "s|@@SHARE@@|$share|") $out/bin/$pname
|
||||
'';
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
1937
pkgs/btcpayserver/deps.nix
Normal file
1937
pkgs/btcpayserver/deps.nix
Normal file
File diff suppressed because it is too large
Load Diff
6
pkgs/btcpayserver/update.sh
Executable file
6
pkgs/btcpayserver/update.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd)
|
||||
|
||||
"$scriptDir"/../nbxplorer/util/update-common.sh btcpayserver "$scriptDir"/deps.nix
|
@ -1,5 +1,5 @@
|
||||
{ pkgs ? import <nixpkgs> {} }:
|
||||
{
|
||||
let self = {
|
||||
lightning-charge = pkgs.callPackage ./lightning-charge { };
|
||||
nanopos = pkgs.callPackage ./nanopos { };
|
||||
spark-wallet = pkgs.callPackage ./spark-wallet { };
|
||||
@ -12,8 +12,13 @@
|
||||
nixops19_09 = pkgs.callPackage ./nixops { };
|
||||
netns-exec = pkgs.callPackage ./netns-exec { };
|
||||
lightning-loop = pkgs.callPackage ./lightning-loop { };
|
||||
btcpayserver = pkgs.callPackage ./btcpayserver { inherit (self) linkFarmFromDrvs; };
|
||||
nbxplorer = pkgs.callPackage ./nbxplorer { inherit (self) linkFarmFromDrvs; };
|
||||
|
||||
# Temporary backport for btcpayserver
|
||||
linkFarmFromDrvs = pkgs.linkFarmFromDrvs or self.pinned.nixpkgsUnstable.linkFarmFromDrvs;
|
||||
|
||||
pinned = import ./pinned.nix;
|
||||
|
||||
lib = import ./lib.nix { inherit (pkgs) lib; };
|
||||
}
|
||||
}; in self
|
||||
|
54
pkgs/nbxplorer/default.nix
Normal file
54
pkgs/nbxplorer/default.nix
Normal file
@ -0,0 +1,54 @@
|
||||
{ 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.42";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "dgarage";
|
||||
repo = "NBXplorer";
|
||||
rev = "v${version}";
|
||||
sha256 = "01q6n7095rrha00xs3l7igzfb9rd743z8crxa2dcz4q5srapfzpi";
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
}
|
1072
pkgs/nbxplorer/deps.nix
Normal file
1072
pkgs/nbxplorer/deps.nix
Normal file
File diff suppressed because it is too large
Load Diff
6
pkgs/nbxplorer/update.sh
Executable file
6
pkgs/nbxplorer/update.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd)
|
||||
|
||||
getVersionFromTags=1 "$scriptDir"/util/update-common.sh nbxplorer "$scriptDir"/deps.nix
|
45
pkgs/nbxplorer/util/create-deps.sh
Executable file
45
pkgs/nbxplorer/util/create-deps.sh
Executable file
@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p dotnet-sdk_3
|
||||
set -euo pipefail
|
||||
|
||||
# Writes deps for dotnet package in $pkgSrc to $depsFile.
|
||||
# Expects $pkgSrc to contain a single .sln file.
|
||||
|
||||
pkgSrc=$1
|
||||
depsFile=$2
|
||||
|
||||
sln=$(cd "$pkgSrc"; find * -maxdepth 0 -name '*.sln' | head -1)
|
||||
[[ $sln ]] || { echo "No .sln file in $pkgSrc" ; exit 1; }
|
||||
|
||||
tmpdir=$(mktemp -d /tmp/$pkgName-src.XXX)
|
||||
trap "rm -rf $tmpdir" EXIT
|
||||
echo "Using tmp dir: $tmpdir"
|
||||
cp -rT "$pkgSrc" "$tmpdir"
|
||||
chmod -R +w "$tmpdir"
|
||||
|
||||
pushd "$tmpdir" > /dev/null
|
||||
mkdir home
|
||||
echo "Running dotnet restore for $sln"
|
||||
HOME=home DOTNET_CLI_TELEMETRY_OPTOUT=1 \
|
||||
dotnet restore -v normal --no-cache "$sln" > restore_log
|
||||
|
||||
echo "{ fetchNuGet }: [" > "$depsFile"
|
||||
while read pkgSpec; do
|
||||
{ read name; read version; } < <(
|
||||
# Ignore build version part: 1.0.0-beta2+77df2220 -> 1.0.0-beta2
|
||||
sed -nE 's/.*<id>([^<]*).*/\1/p; s/.*<version>([^<+]*).*/\1/p' "$pkgSpec"
|
||||
)
|
||||
sha256=$(nix-hash --type sha256 --flat --base32 "$(dirname "$pkgSpec")"/*.nupkg)
|
||||
cat >> "$depsFile" <<EOF
|
||||
(fetchNuGet {
|
||||
name = "$name";
|
||||
version = "$version";
|
||||
sha256 = "$sha256";
|
||||
})
|
||||
EOF
|
||||
done < <(find home/.nuget/packages -name '*.nuspec' | LC_ALL=C sort)
|
||||
echo "]" >> "$depsFile"
|
||||
|
||||
echo "Created $depsFile"
|
||||
|
||||
popd > /dev/null
|
50
pkgs/nbxplorer/util/update-common.sh
Executable file
50
pkgs/nbxplorer/util/update-common.sh
Executable file
@ -0,0 +1,50 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#!nix-shell -i bash -p coreutils curl jq common-updater-scripts dotnet-sdk_3
|
||||
set -euo pipefail
|
||||
|
||||
# This script uses the following env vars:
|
||||
# getVersionFromTags
|
||||
# onlyCreateDeps
|
||||
|
||||
pkgName=$1
|
||||
depsFile=$2
|
||||
|
||||
: ${getVersionFromTags:=}
|
||||
: ${onlyCreateDeps:=}
|
||||
|
||||
scriptDir=$(cd "${BASH_SOURCE[0]%/*}" && pwd)
|
||||
nbPkgs=$(realpath "$scriptDir"/../..)
|
||||
|
||||
evalNbPkgs() {
|
||||
nix eval --raw "(with import \"$nbPkgs\" {}; $1)"
|
||||
}
|
||||
|
||||
getRepo() {
|
||||
url=$(evalNbPkgs $pkgName.src.meta.homepage)
|
||||
echo $(basename $(dirname $url))/$(basename $url)
|
||||
}
|
||||
|
||||
getLatestVersionTag() {
|
||||
unstable=$(nix eval --raw "(import \"$nbPkgs/nixpkgs-pinned.nix\").nixpkgs-unstable")
|
||||
$unstable/pkgs/common-updater/scripts/list-git-tags https://github.com/$(getRepo) 2>/dev/null \
|
||||
| sort -V | tail -1 | sed 's|^v||'
|
||||
}
|
||||
|
||||
if [[ ! $onlyCreateDeps ]]; then
|
||||
oldVersion=$(evalNbPkgs "$pkgName.version")
|
||||
if [[ $getVersionFromTags ]]; then
|
||||
newVersion=$(getLatestVersionTag)
|
||||
else
|
||||
newVersion=$(curl -s "https://api.github.com/repos/$(getRepo)/releases" | jq -r '.[0].name')
|
||||
fi
|
||||
|
||||
if [[ $newVersion == $oldVersion ]]; then
|
||||
echo "$pkgName is up to date: $newVersion"
|
||||
else
|
||||
echo "Please manually update $pkgName: $oldVersion -> $newVersion"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Creating deps.nix"
|
||||
storeSrc="$(nix-build "$nbPkgs" -A $pkgName.src --no-out-link)"
|
||||
. "$scriptDir"/create-deps.sh "$storeSrc" "$depsFile"
|
@ -17,4 +17,5 @@ in
|
||||
|
||||
stable = nixBitcoinPkgsStable;
|
||||
unstable = nixBitcoinPkgsUnstable;
|
||||
inherit nixpkgsUnstable;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user