phoenixd: 0.5.0 -> 0.6.0

This commit is contained in:
emaryn
2025-05-22 02:55:32 +08:00
parent a1fc88bb0b
commit c9b03fc36c
2 changed files with 64 additions and 30 deletions
+40 -30
View File
@@ -1,6 +1,6 @@
{
stdenv,
lib,
stdenv,
fetchurl,
unzip,
autoPatchelfHook,
@@ -9,32 +9,35 @@
zlib,
}:
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
pname = "phoenixd";
version = "0.5.0";
version = "0.6.0";
suffix =
{
aarch64-darwin = "macos-arm64";
x86_64-darwin = "macos-x64";
x86_64-linux = "linux-x64";
}
.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
src =
let
selectSystem =
attrs:
attrs.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
suffix = selectSystem {
aarch64-darwin = "macos-arm64";
x86_64-darwin = "macos-x64";
x86_64-linux = "linux-x64";
aarch64-linux = "linux-arm64";
};
in
fetchurl {
url = "https://github.com/ACINQ/phoenixd/releases/download/v${finalAttrs.version}/phoenixd-${finalAttrs.version}-${suffix}.zip";
hash = selectSystem {
aarch64-darwin = "sha256-CJCGVL6az02Yxdj7RpXMScSdx+yKvMfBMKE0SaBYTow=";
x86_64-darwin = "sha256-ClSyQ8Ir13wVBBpYivv2W+s5ZlYrx+6drUbUp5EhlBo=";
x86_64-linux = "sha256-z+gfiFor8nDHl2vjGCA0RYKrUXmdiRX6ztucXOOxLoI=";
aarch64-linux = "sha256-YkGJJS3dSHtxB891urGdL3f5F5TYIKBHKRrREAk5NkM=";
};
};
src = fetchurl {
url = "https://github.com/ACINQ/phoenixd/releases/download/v${version}/phoenix-${version}-${suffix}.zip";
hash =
{
aarch64-darwin = "sha256-hfg/gca27t8psG1+7u5DvHCuQDQJou6Fp3+ySaz+MXc=";
x86_64-darwin = "sha256-qpwkt2rbilpQVmAkl6Q4XyecSzayzYb1k5H5ur7SItk=";
x86_64-linux = "sha256-lshsJQ9km8C+KDtp1nQiK8h7LJN3A8GlGN6Yhb3VPtk=";
}
.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}");
};
nativeBuildInputs = [ unzip ] ++ lib.optionals stdenv.hostPlatform.isLinux [ autoPatchelfHook ];
nativeBuildInputs = [ unzip ] ++ lib.optionals stdenv.isLinux [ autoPatchelfHook ];
buildInputs = lib.optionals stdenv.isLinux [
buildInputs = lib.optionals stdenv.hostPlatform.isLinux [
libgcc # provides libgcc_s.so.1
libxcrypt-legacy # provides libcrypt.so.1
zlib # provides libz.so.1
@@ -43,17 +46,24 @@ stdenv.mkDerivation rec {
installPhase = ''
runHook preInstall
mkdir -p $out/bin
cp phoenix{-cli,d} $out/bin/
install -Dm0755 phoenix-cli $out/bin/phoenix-cli
install -Dm0755 phoenixd $out/bin/phoenixd
runHook postInstall
'';
meta = with lib; {
passthru.updateScript = ./update.sh;
meta = {
description = "Server equivalent of the popular Phoenix wallet for mobile";
homepage = "https://phoenix.acinq.co/server";
license = licenses.asl20;
maintainers = with maintainers; [ prusnak ];
platforms = platforms.linux ++ platforms.darwin;
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ prusnak ];
platforms = [
"aarch64-linux"
"aarch64-darwin"
"x86_64-linux"
"x86_64-darwin"
];
};
}
})
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env nix-shell
#!nix-shell -i bash -p bash nix curl coreutils common-updater-scripts nix-update
set -eou pipefail
currentVersion=$(nix-instantiate --eval -E "with import ./. {}; phoenixd.version or (lib.getVersion phoenixd)" | tr -d '"')
nix-update phoenixd --system x86_64-linux
latestVersion=$(nix-instantiate --eval -E "with import ./. {}; phoenixd.version or (lib.getVersion phoenixd)" | tr -d '"')
echo "latest version: $latestVersion"
echo "current version: $currentVersion"
if [[ "$latestVersion" == "$currentVersion" ]]; then
echo "package is up-to-date"
exit 0
fi
for system in \
aarch64-linux \
x86_64-darwin \
aarch64-darwin; do
hash=$(nix hash convert --to sri --hash-algo sha256 $(nix-prefetch-url $(nix-instantiate --eval -E "with import ./. {}; phoenixd.src.url" --system "$system" | tr -d '"')))
update-source-version phoenixd $latestVersion $hash --system=$system --ignore-same-version
done