services.cardano-graphql = {
enable = lib.mkEnableOption "cardano-explorer graphql service";
-
dbHost = lib.mkOption {
-
default = "/run/postgresql";
-
dbPassword = lib.mkOption {
-
dbPort = lib.mkOption {
-
dbUser = lib.mkOption {
enginePort = lib.mkOption {
description = "Source directory or file to generate allow-list from";
-
metadataServerUri = lib.mkOption {
-
type = lib.types.nullOr lib.types.str;
pollingIntervalAdaSupply = lib.mkOption {
type = lib.types.nullOr lib.types.int;
-
assetMetadataUpdateInterval = lib.mkOption {
-
type = lib.types.nullOr lib.types.int;
maxQueryComplexity = lib.mkOption {
type = lib.types.nullOr lib.types.int;
boolToNodeJSEnv = bool: if bool then "true" else "false";
frontend = selfPkgs.packages.cardano-graphql;
persistgraphql = selfPkgs.packages.persistgraphql;
-
hasura-cli = selfPkgs.packages.hasura-cli;
-
hasura-cli-ext = selfPkgs.packages.hasura-cli-ext;
hasuraBaseUri = "${cfg.hasuraProtocol}://${cfg.hasuraIp}:${toString cfg.enginePort}";
pluginLibPath = pkgs.lib.makeLibraryPath [
-
# always start with no plugins so future upgrades will work
-
rm -rf ~/.hasura/plugins
-
mkdir -p ~/.hasura/plugins/store/cli-ext/v${hasura-cli-ext.version}
-
ln -s ${hasura-cli-ext}/bin/cli-ext-hasura-linux ~/.hasura/plugins/store/cli-ext/v${hasura-cli-ext.version}/cli-ext-hasura-linux
systemd.services.cardano-graphql = {
wantedBy = [ "multi-user.target" ];
wants = [ "graphql-engine.service" ];
after = [ "graphql-engine.service" ];
environment = lib.filterAttrs (k: v: v != null) {
CARDANO_NODE_CONFIG_PATH = cfg.cardanoNodeConfigPath;
-
HASURA_CLI_PATH = hasura-cli + "/bin/hasura";
HASURA_GRAPHQL_ENABLE_TELEMETRY = toString false;
HASURA_URI = hasuraBaseUri;
LOGGER_MIN_SEVERITY = cfg.loggerMinSeverity;
OGMIOS_HOST = cfg.ogmiosHost;
OGMIOS_PORT = toString cfg.ogmiosPort;
-
POSTGRES_HOST = cfg.dbHost;
-
POSTGRES_PASSWORD = cfg.dbPassword;
-
POSTGRES_PORT = toString cfg.dbPort;
-
POSTGRES_USER = cfg.dbUser;
PROMETHEUS_METRICS = boolToNodeJSEnv cfg.enablePrometheus;
TRACING = boolToNodeJSEnv (cfg.enableTracing || cfg.enablePrometheus);
ALLOW_INTROSPECTION = boolToNodeJSEnv cfg.allowIntrospection;
(lib.optionalAttrs (cfg.allowedOrigins != null) { ALLOWED_ORIGINS = cfg.allowedOrigins; }) //
(lib.optionalAttrs (cfg.listenAddress != null) { LISTEN_ADDRESS = cfg.listenAddress; }) //
-
(lib.optionalAttrs (cfg.metadataServerUri != null) { METADATA_SERVER_URI = toString cfg.metadataServerUri; }) //
(lib.optionalAttrs (cfg.pollingIntervalAdaSupply != null) { POLLING_INTERVAL_ADA_SUPPLY = toString cfg.pollingIntervalAdaSupply; }) //
-
(lib.optionalAttrs (cfg.assetMetadataUpdateInterval != null) { ASSET_METADATA_UPDATE_INTERVAL = toString cfg.assetMetadataUpdateInterval; }) //
(lib.optionalAttrs (cfg.queryDepthLimit != null) { QUERY_DEPTH_LIMIT = toString cfg.queryDepthLimit; }) //
(lib.optionalAttrs (cfg.allowListPath != null) { ALLOW_LIST_PATH = cfg.allowListPath; }) //
(lib.optionalAttrs (cfg.maxQueryComplexity != null) { MAX_QUERY_COMPLEXITY = toString cfg.maxQueryComplexity; });
-
path = with pkgs; [ netcat curl postgresql frontend hasura-cli glibc.bin patchelf ];
+
path = with pkgs; [ netcat curl frontend glibc.bin patchelf ];