mempool: add frontend settings

This commit is contained in:
Erik Arvstedt 2025-06-01 23:03:33 +02:00
parent 81112a0553
commit 7822e2c9d3
No known key found for this signature in database
GPG key ID: 33312B944DD97846
3 changed files with 33 additions and 4 deletions

View file

@ -79,7 +79,14 @@ rec {
};
};
mempool-frontend = mkDerivationMempool {
mempool-frontend = mkFrontend {};
# Argument `config` (type: attrset) defines the mempool frontend config.
# If `{}`, the default config is used.
# See here for available options:
# https://github.com/mempool/mempool/blob/master/frontend/src/app/services/state.service.ts
# (`interface Env` and `defaultEnv`)
mkFrontend = config: mkDerivationMempool {
pname = "mempool-frontend";
buildPhase = ''
@ -92,6 +99,10 @@ rec {
# internet. Disable this script and instead add the assets manually after building.
: > sync-assets.js
${lib.optionalString (config != {}) ''
ln -s ${builtins.toFile "mempool-frontend-config" (builtins.toJSON config)} mempool-frontend-config.json
''}
npm run build
# Add assets that would otherwise be downloaded by sync-assets.js
@ -107,6 +118,7 @@ rec {
'';
passthru = {
withConfig = mkFrontend;
assets = frontendAssets;
nodeModules = nodeModules.frontend;
};