python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / applications / misc / electrum / update.nix
blob247fabe3891f1e142f56af3f69f603d998f0a641
1 { lib
2 , writeScript
3 , common-updater-scripts
4 , bash
5 , coreutils
6 , curl
7 , gnugrep
8 , gnupg
9 , gnused
10 , nix
13 with lib;
15 let
16   downloadPageUrl = "https://download.electrum.org";
18   signingKeys = ["6694 D8DE 7BE8 EE56 31BE D950 2BD5 824B 7F94 70E6"];
21 writeScript "update-electrum" ''
22 #! ${bash}/bin/bash
24 set -eu -o pipefail
26 export PATH=${makeBinPath [
27   common-updater-scripts
28   coreutils
29   curl
30   gnugrep
31   gnupg
32   gnused
33   nix
36 version=$(curl -L --list-only -- '${downloadPageUrl}' \
37     | grep -Po '<a href="\K([[:digit:]]+\.?)+' \
38     | sort -Vu \
39     | tail -n1)
41 srcName=Electrum-$version
42 srcFile=$srcName.tar.gz
43 srcUrl="${downloadPageUrl}/$version/$srcFile"
44 sigUrl=$srcUrl.asc
45 sigFile=$srcFile.asc
47 [[ -e "$srcFile" ]] || curl -L -o "$srcFile" -- "$srcUrl"
48 [[ -e "$sigFile" ]] || curl -L -o "$sigFile" -- "$sigUrl"
50 export GNUPGHOME=$PWD/gnupg
51 mkdir -m 700 -p "$GNUPGHOME"
53 gpg --batch --recv-keys ${concatStringsSep " " (map (x: "'${x}'") signingKeys)}
54 gpg --batch --verify "$sigFile" "$srcFile"
56 sha256=$(nix-prefetch-url --type sha256 "file://$PWD/$srcFile")
58 update-source-version electrum "$version" "$sha256"