nbxplorer: init at 2.1.42

This commit is contained in:
Calvin Kim 2020-08-11 02:49:20 +09:00 committed by Erik Arvstedt
parent 44cb86f0d8
commit 2724f7be54
No known key found for this signature in database
GPG Key ID: 33312B944DD97846
6 changed files with 1231 additions and 1 deletions

View 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;
};
}

File diff suppressed because it is too large Load Diff

View 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

View 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)
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
rm -r $tmpdir

View File

@ -0,0 +1,51 @@
#!/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)
nixpkgs=$(realpath "$scriptDir"/../../../../..)
evalNixpkgs() {
nix eval --raw "(with import \"$nixpkgs\" {}; $1)"
}
getRepo() {
url=$(evalNixpkgs $pkgName.src.meta.homepage)
echo $(basename $(dirname $url))/$(basename $url)
}
getLatestVersionTag() {
"$nixpkgs"/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=$(evalNixpkgs "$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 "nixpkgs already has the latest version $newVersion"
echo "Run this script with env var onlyCreateDeps=1 to recreate "$(basename "$depsFile")
exit 0
else
echo "Updating $pkgName: $oldVersion -> $newVersion"
(cd "$nixpkgs" && update-source-version "$pkgName" "$newVersion")
fi
fi
storeSrc="$(nix-build "$nixpkgs" -A $pkgName.src --no-out-link)"
. "$scriptDir"/create-deps.sh "$storeSrc" "$depsFile"

View File

@ -24429,7 +24429,9 @@ in
namecoin = callPackage ../applications/blockchains/namecoin.nix { withGui = true; };
namecoind = callPackage ../applications/blockchains/namecoin.nix { withGui = false; };
pivx = libsForQt514.callPackage ../applications/blockchains/pivx.nix { withGui = true; };
nbxplorer = callPackage ../applications/blockchains/nbxplorer { };
pivx = libsForQt5.callPackage ../applications/blockchains/pivx.nix { withGui = true; };
pivxd = callPackage ../applications/blockchains/pivx.nix { withGui = false; };
ethabi = callPackage ../applications/blockchains/ethabi.nix { };