Skip to content

Commit

Permalink
CAD-2712 cardano-node.service: node executable config option
Browse files Browse the repository at this point in the history
  • Loading branch information
deepfire committed Mar 4, 2021
1 parent 573fc43 commit 50840ef
Showing 1 changed file with 22 additions and 14 deletions.
36 changes: 22 additions & 14 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

0 comments on commit 50840ef

Please sign in to comment.