Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CAD-2717: cardano node service extensions #2443

Merged
merged 2 commits into from
Mar 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions nix/nixos/cardano-node-service.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,21 @@ let
];
};
instanceDbPath = "${cfg.databasePath}${optionalString (i > 0) "-${toString i}"}";
exec = "cardano-node run";
cmd = builtins.filter (x: x != "") [
"${cfg.package}/bin/${exec}"
"--config ${realNodeConfigFile}"
"--database-path ${instanceDbPath}"
"--topology ${topology}"
] ++ (lib.optionals (!cfg.systemdSocketActivation) ([
"--host-addr ${cfg.hostAddr}"
"--port ${toString (cfg.port + i)}"
"--socket-path ${cfg.socketPath}"
] ++ lib.optional (cfg.ipv6HostAddr != null)
"--host-ipv6-addr ${cfg.ipv6HostAddr}"
)) ++ consensusParams.${cfg.nodeConfig.Protocol} ++ cfg.extraArgs ++ cfg.rtsArgs;
cmd = builtins.filter (x: x != "") [
"${cfg.executable} run"
"--config ${realNodeConfigFile}"
"--database-path ${instanceDbPath}"
"--topology ${topology}"
] ++ (lib.optionals (!cfg.systemdSocketActivation) ([
"--host-addr ${cfg.hostAddr}"
"--port ${toString (cfg.port + i)}"
"--socket-path ${cfg.socketPath}"
] ++ lib.optional (cfg.ipv6HostAddr != null)
"--host-ipv6-addr ${cfg.ipv6HostAddr}"
)) ++ consensusParams.${cfg.nodeConfig.Protocol} ++ cfg.extraArgs ++ cfg.rtsArgs;
in ''
choice() { i=$1; shift; eval "echo \''${$((i + 1))}"; }
echo "Starting ${exec}: ${concatStringsSep "\"\n echo \"" cmd}"
echo "Starting: ${concatStringsSep "\"\n echo \"" cmd}"
echo "..or, once again, in a single line:"
echo "${toString cmd}"
${lib.optionalString (cfg.environment == "selfnode") ''
Expand Down Expand Up @@ -165,6 +164,15 @@ in {
'';
};

executable = mkOption {
type = types.str;
default = "${cfg.package}/bin/cardano-node";
defaultText = "cardano-node";
description = ''
The cardano-node executable invocation to use
'';
};

environments = mkOption {
type = types.attrs;
default = commonLib.environments;
Expand Down Expand Up @@ -391,7 +399,7 @@ in {
};

topology = mkOption {
type = types.nullOr types.path;
type = types.nullOr (types.either types.str types.path);
default = null;
description = ''
Cluster topology. If not set `producers` array is used to generated topology file.
Expand Down