Skip to content

Commit

Permalink
feat(hubble): add all options to module
Browse files Browse the repository at this point in the history
  • Loading branch information
cor committed Sep 13, 2023
1 parent 0432c1d commit 4667f6f
Showing 1 changed file with 25 additions and 4 deletions.
29 changes: 25 additions & 4 deletions hubble/hubble.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@
type = types.string;
default = "https://graphql.union.build";
};
hasura-admin-secret = mkOption {
type = types.string;
};
indexers = mkOption {
type = types.listOf types.attrset;
description = ''
Note that example.chain_id is optional.
'';
example = [
{
url = "https://rpc.example.com";
chain_id = "union-example-devnet";
}
];
};
};

config = mkIf cfg.enable {
Expand All @@ -48,17 +63,23 @@
hubble-systemd-script = pkgs.writeShellApplication {
name = "hubble-systemd";
runtimeInputs = [ pkgs.coreutils cfg.package ];
text = ''
${lib.getExe cfg.package} --url ${cfg.url}
'';

text =
let
secretArg = if cfg.hasura-admin-secret then "--secret ${cfg.hasura-admin-secret}" else "";
indexersJson = builtins.toJSON cfg.indexers;
in
''
${lib.getExe cfg.package} --url ${cfg.url} ${secretArg} --indexers ${indexersJson}
'';
};
in
{
wantedBy = [ "multi-user.target" ];
description = "Hubble";
serviceConfig = {
Type = "simple";
ExecStart = pkgs.lib.getExe unionvisor-systemd-script;
ExecStart = pkgs.lib.getExe hubble-systemd-script;
Restart = mkForce "always";
};
};
Expand Down

0 comments on commit 4667f6f

Please sign in to comment.