Skip to content

Commit cf0618a

Browse files
committed
refactor: Register Ogmios and Kupo as providers
Signed-off-by: Alexander V. Nikolaev <[email protected]>
1 parent 0c1c75a commit cf0618a

File tree

3 files changed

+34
-0
lines changed

3 files changed

+34
-0
lines changed

modules/kupo.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,13 @@ in
2424
after = lib.optional (config.cardano.node.enable or false) "cardano-node-socket.service" ++ lib.optional (config.cardano.ogmios.enable or false) "ogmios.service";
2525
requires = lib.optional (config.cardano.node.enable or false) "cardano-node-socket.service" ++ lib.optional (config.cardano.ogmios.enable or false) "ogmios.service";
2626
};
27+
28+
# Register as default Kupo provider for others `cardano.nix` consumers
29+
cardano.providers.kupo = {
30+
active = true;
31+
inherit (config.service.kupo) host port;
32+
after = "kupo.service";
33+
requires = "kupo.service";
34+
};
2735
};
2836
}

modules/ogmios.nix

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,13 @@ in
2222
after = [ "cardano-node-socket.service" ];
2323
requires = [ "cardano-node-socket.service" ];
2424
};
25+
26+
# Register as default Ogmios provider for others `cardano.nix` consumers
27+
cardano.providers.ogmios = {
28+
active = true;
29+
inherit (config.service.ogmios) host port;
30+
after = "ogmios.service";
31+
requires = "ogmios.service";
32+
};
2533
};
2634
}

modules/providers.nix

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,22 @@ let
5252
'';
5353
};
5454
};
55+
tcpOptions = name: {
56+
host = mkOption {
57+
type = types.str;
58+
internal = true;
59+
description = ''
60+
Host address for TCP connection to ${name}, to refer by consumers.
61+
'';
62+
};
63+
port = mkOption {
64+
type = types.port;
65+
internal = true;
66+
description = ''
67+
Port address for TCP connection to ${name}, to refer by consumers.
68+
'';
69+
};
70+
};
5571
in
5672
{
5773
options.cardano.providers = mkOption {
@@ -60,6 +76,8 @@ in
6076
type = types.submodule {
6177
options = {
6278
node = sharedOptions // socketOptions "cardano node";
79+
ogmios = sharedOptions // tcpOptions "Ogmios";
80+
kupo = sharedOptions // tcpOptions "Kupo";
6381
};
6482
};
6583
};

0 commit comments

Comments
 (0)