diff --git a/docs/fork-maintenance.md b/docs/fork-maintenance.md index dc459f5..7f9c640 100644 --- a/docs/fork-maintenance.md +++ b/docs/fork-maintenance.md @@ -30,7 +30,7 @@ declares: | `services.bitcoind` | on, `bitcoind-32.1` from system nixpkgs, `i2p = false` | | `services.lnd` | on, package overridden to nix-pleb's `unstablePkgs.lnd` | | `services.electrs` | on, from system nixpkgs | -| `services.mempool` | on, fork-packaged `mempool-*-3.2.1`, `electrumServer = "electrs"` | +| `services.mempool` | on, fork-packaged `mempool-*-3.3.2`, `electrumServer = "electrs"` | | `nix-bitcoin.operator` | on (`pleb`) | | `nix-bitcoin.nodeinfo` | on (from secure-node preset) | | `nix-bitcoin.generateSecrets` | on, `secretsSetupMethod = "setup-secrets"` | @@ -163,12 +163,21 @@ Ordered from most to least work: node modules, the frontend-assets fetch, and the rust-gbt cargo vendor), a local patch (`0001-allow-disabling-mining-pool-fetching.patch`), and a pinned - `nodejs_22`. It's at 3.2.1 against upstream's 3.3.2. Expect every - version bump to need the hashes redone. Node 22 also has an end-of-life - date, after which nixpkgs will drop `nodejs_22` and force a Node bump - here. nixpkgs doesn't package mempool, so there's no upstream to lean - on. If you ever stop wanting the mempool UI, removing it is the - biggest maintenance cut available. + `nodejs_26` / `nodejs-slim_26`. It's at 3.3.2, level with upstream, + and builds the frontend in en-US only. Expect every version bump to + need the hashes redone. Node 26 also has an end-of-life date, after + which nixpkgs will drop `nodejs_26` and force a Node bump here. + nixpkgs doesn't package mempool, so there's no upstream to lean on. If + you ever stop wanting the mempool UI, removing it is the biggest + maintenance cut available. + + `generate.sh` accepts a release tag only if it's signed by one of two + pinned fingerprints: wiz (`913C…6173`, on keyservers and Keybase) or + mononaut (`523B…CD8D`, who has signed releases since v3.3.0). Mononaut's + key is fetched from `github.com/mononaut.gpg`. It is a new key (created + 2026-04-14), not cross-signed by anyone and not on keyservers or Keybase, + so trust in it rests on mononaut's GitHub account. If a release is + signed by any other key, find out why before adding its fingerprint. 2. **`mempool.nix` module**: configures mariadb, nginx (includes `mempool-nginx-conf` from the package) and the backend's JSON config. It follows NixOS changes to the mysql and nginx modules and mempool's diff --git a/pkgs/mempool/default.nix b/pkgs/mempool/default.nix index bf7cc83..98ec6d5 100644 --- a/pkgs/mempool/default.nix +++ b/pkgs/mempool/default.nix @@ -1,7 +1,7 @@ { lib , stdenvNoCC -, nodejs_22 -, nodejs-slim_22 +, nodejs_26 +, nodejs-slim_26 , fetchFromGitHub , fetchNodeModules , runCommand @@ -16,34 +16,34 @@ , napi-rs-cli }: rec { - nodejs = nodejs_22; - nodejsRuntime = nodejs-slim_22; + nodejs = nodejs_26; + nodejsRuntime = nodejs-slim_26; - version = "3.2.1"; + version = "3.3.2"; src = fetchFromGitHub { owner = "mempool"; repo = "mempool"; tag = "v${version}"; - hash = "sha256-O2XPD1/BXQnzuOP/vMVyRfmFZEgjA85r+PShWne0vqU="; + hash = "sha256-xMMBr3bSOwVNgpjOPVf7MEcGvhhNneTsE8PH9sLUr30="; }; nodeModules = { frontend = fetchNodeModules { inherit src nodejs; sourceRoot = "source/frontend"; - hash = "sha256-+jfgsAkDdYvgso8uSHaBj/sQL3fC/ABQWzVTXfdZcU0="; + hash = "sha256-LRK2W5Ypml5QSTWTHtUpilDXm5gIt13wL0pGBgkhhvk="; }; backend = fetchNodeModules { inherit src nodejs; sourceRoot = "source/backend"; - hash = "sha256-y5l2SYZYK9SKSy6g0+mtTWD6JFkkdQHHBboECpEvWZ4="; + hash = "sha256-jszxFq1+H9D0p0NNB6q0iFoVy2gLAmdlnzPDK8ywJo0="; }; }; frontendAssets = fetchFiles { name = "mempool-frontend-assets"; - hash = "sha256-r6GfOY8Pdh15o2OQMk8syfvWMV6WMCReToAEkQm7tqQ="; + hash = "sha256-hnW3VUTFgrQyDWizdxYaX6Vf2m/+RYp1x2cWCg+8HM0="; fetcher = ./frontend-assets-fetch.sh; }; @@ -99,6 +99,23 @@ rec { # internet. Disable this script and instead add the assets manually after building. : > sync-assets.js + # Only build the en-US locale instead of all ~30 translations. + # This greatly reduces build time. The output layout (`/index.html`) + # is unchanged, and nginx falls back to `en-US` for all other languages. + substituteInPlace package.json --replace-fail 'production --localize' 'production' + node -e ' + const fs = require("fs"); + const f = "angular.json"; + const a = JSON.parse(fs.readFileSync(f)); + a.projects.mempool.architect.build.options.localize = ["en-US"]; + fs.writeFileSync(f, JSON.stringify(a, null, 2)); + ' + + # The Nix builder's stdout is a pty, so the Angular CLI enables its interactive + # progress spinners. These redraw endlessly (gigabytes of escape codes) and + # stall the build. Disable TTY detection. + export NG_FORCE_TTY=false + ${lib.optionalString (config != {}) '' ln -s ${builtins.toFile "mempool-frontend-config" (builtins.toJSON config)} mempool-frontend-config.json ''} diff --git a/pkgs/mempool/frontend-assets-fetch.sh b/pkgs/mempool/frontend-assets-fetch.sh index 07f69f8..4de2afd 100755 --- a/pkgs/mempool/frontend-assets-fetch.sh +++ b/pkgs/mempool/frontend-assets-fetch.sh @@ -8,7 +8,7 @@ set -euo pipefail # This file is updated by ./frontend-assets-update.sh declare -A revs=( - ["mempool/mining-pool-logos"]=53972ebbd08373cf4910cbb3e6421a1f3bba4563 + ["mempool/mining-pool-logos"]=059212bff7194617153c4307bc7acfccea057b6c ) fetchFile() { diff --git a/pkgs/mempool/generate.sh b/pkgs/mempool/generate.sh index 5945cab..7194171 100755 --- a/pkgs/mempool/generate.sh +++ b/pkgs/mempool/generate.sh @@ -1,11 +1,11 @@ #!/usr/bin/env nix-shell -#! nix-shell -i bash -p gnupg gnused jq +#! nix-shell -i bash -p gnupg gnused jq curl set -euo pipefail # Use this to start a debug shell at the location of this statement # . "${BASH_SOURCE[0]%/*}/../../helper/start-bash-session.sh" -version=3.2.1 +version=3.3.2 # You can also specify a rev instead: # rev=57eddac7f0b99b4fe84d91c0f4a50a4f7ccfe55f owner=mempool @@ -31,9 +31,21 @@ updateSrc() { git clone --depth 1 --branch "$tag" -c advice.detachedHead=false $repo "$src" git -C "$src" checkout tags/$tag export GNUPGHOME=$TMPDIR + # Release tags are signed by one of these keys + trustedKeys=( + 913C5FF1F579B66CA10378DBA394E332255A6173 # wiz + 523B596A78BB8495AA2EC45ABFD16BE592A9CD8D # mononaut (since v3.3.0) + ) # Fetch wiz' key - gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 913C5FF1F579B66CA10378DBA394E332255A6173 2> /dev/null - git -C "$src" verify-tag $tag + gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys 913C5FF1F579B66CA10378DBA394E332255A6173 2> /dev/null || : + # Fetch mononaut's key (not available on keyservers) + curl -fsS https://github.com/mononaut.gpg | gpg --import 2> /dev/null + signer=$(git -C "$src" verify-tag --raw $tag 2>&1 | sed -nE 's/^\[GNUPG:\] VALIDSIG ([0-9A-F]+) .*/\1/p') + if [[ ! " ${trustedKeys[*]} " =~ " $signer " ]]; then + echo "Error: Tag $tag is not signed by a trusted key (signer: ${signer:-none})" + exit 1 + fi + echo "Tag $tag has a valid signature by $signer" rev=$tag fi rm -rf "$src"/.git diff --git a/pkgs/mempool/nginx-conf/location-static.conf b/pkgs/mempool/nginx-conf/location-static.conf index fd6d4fc..2f16d3a 100644 --- a/pkgs/mempool/nginx-conf/location-static.conf +++ b/pkgs/mempool/nginx-conf/location-static.conf @@ -4,12 +4,10 @@ # see order of nginx location rules # https://stackoverflow.com/questions/5238377/nginx-location-priority -# for exact / requests, redirect based on $lang -# cache redirect for 5 minutes +# for exact / requests, serve en-US. +# (Upstream redirects to /$lang/ here, but the frontend is only built with +# the en-US locale, so all other language paths would just serve en-US.) location = / { - if ($lang != '') { - return 302 $scheme://$host/$lang/; - } try_files /en-US/index.html =404; expires 5m; }