mempool: add frontend settings
This commit is contained in:
parent
81112a0553
commit
7822e2c9d3
3 changed files with 33 additions and 4 deletions
|
|
@ -111,7 +111,10 @@ with lib;
|
||||||
];
|
];
|
||||||
services.mempool = {
|
services.mempool = {
|
||||||
enable = true;
|
enable = true;
|
||||||
frontend.address = "0.0.0.0";
|
frontend = {
|
||||||
|
address = "0.0.0.0";
|
||||||
|
settings.LIQUID_ENABLED = true;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
nix-bitcoin.nodeinfo.enable = true;
|
nix-bitcoin.nodeinfo.enable = true;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,23 @@ let
|
||||||
default = 60845; # A random private port
|
default = 60845; # A random private port
|
||||||
description = "HTTP server port.";
|
description = "HTTP server port.";
|
||||||
};
|
};
|
||||||
|
settings = mkOption {
|
||||||
|
type = with types; attrsOf anything;
|
||||||
|
default = {};
|
||||||
|
example = {
|
||||||
|
TESTNET_ENABLED = true;
|
||||||
|
MEMPOOL_WEBSITE_URL = "mempool.mynode.org";
|
||||||
|
};
|
||||||
|
description = ''
|
||||||
|
Mempool frontend settings.
|
||||||
|
See here for available options:
|
||||||
|
https://github.com/mempool/mempool/blob/master/frontend/src/app/services/state.service.ts
|
||||||
|
(`interface Env` and `defaultEnv`)
|
||||||
|
'';
|
||||||
|
};
|
||||||
staticContentRoot = mkOption {
|
staticContentRoot = mkOption {
|
||||||
type = types.path;
|
type = types.path;
|
||||||
default = nbPkgs.mempool-frontend;
|
default = nbPkgs.mempool-frontend.withConfig cfg.frontend.settings;
|
||||||
defaultText = "config.nix-bitcoin.pkgs.mempool-frontend";
|
defaultText = "config.nix-bitcoin.pkgs.mempool-frontend";
|
||||||
description = "
|
description = "
|
||||||
Path of the static frontend content root.
|
Path of the static frontend content root.
|
||||||
|
|
@ -106,7 +120,7 @@ let
|
||||||
};
|
};
|
||||||
description = ''
|
description = ''
|
||||||
Mempool backend settings.
|
Mempool backend settings.
|
||||||
See here for possible options:
|
See here for available options:
|
||||||
https://github.com/mempool/mempool/blob/master/backend/src/config.ts
|
https://github.com/mempool/mempool/blob/master/backend/src/config.ts
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -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";
|
pname = "mempool-frontend";
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
|
|
@ -92,6 +99,10 @@ rec {
|
||||||
# internet. Disable this script and instead add the assets manually after building.
|
# internet. Disable this script and instead add the assets manually after building.
|
||||||
: > sync-assets.js
|
: > sync-assets.js
|
||||||
|
|
||||||
|
${lib.optionalString (config != {}) ''
|
||||||
|
ln -s ${builtins.toFile "mempool-frontend-config" (builtins.toJSON config)} mempool-frontend-config.json
|
||||||
|
''}
|
||||||
|
|
||||||
npm run build
|
npm run build
|
||||||
|
|
||||||
# Add assets that would otherwise be downloaded by sync-assets.js
|
# Add assets that would otherwise be downloaded by sync-assets.js
|
||||||
|
|
@ -107,6 +118,7 @@ rec {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
passthru = {
|
passthru = {
|
||||||
|
withConfig = mkFrontend;
|
||||||
assets = frontendAssets;
|
assets = frontendAssets;
|
||||||
nodeModules = nodeModules.frontend;
|
nodeModules = nodeModules.frontend;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue