diff --git a/nix/nixos/cardano-node-service.nix b/nix/nixos/cardano-node-service.nix index ea42c0d2f45..8038c41b27a 100644 --- a/nix/nixos/cardano-node-service.nix +++ b/nix/nixos/cardano-node-service.nix @@ -13,11 +13,12 @@ let let exec = "cardano-node"; cmd = builtins.filter (x: x != "") [ "${cfg.package}/bin/${exec}" + "run" "--genesis-file ${cfg.genesisFile}" "--genesis-hash ${cfg.genesisHash}" "--config ${cfg.nodeConfigFile}" "--database-path ${cfg.databasePath}" - "--socket-path ${if (cfg.runtimeDir == null) then "${cfg.stateDir}/socket" else "/run/${cfg.runtimeDir}"}" + "--socket-path ${cfg.socketPath}" "--topology ${cfg.topology}" "--host-addr ${cfg.hostAddr}" "--port ${toString cfg.port}" @@ -28,11 +29,12 @@ let ] ++ cfg.extraArgs; in '' choice() { i=$1; shift; eval "echo \''${$((i + 1))}"; } - echo "Starting ${exec}: '' + concatStringsSep "\"\n echo \"" cmd + ''" + echo "Starting ${exec}: ${concatStringsSep "\"\n echo \"" cmd}" echo "..or, once again, in a single line:" - echo "'' + toString cmd + ''" - ls -l ${if (cfg.runtimeDir == null) then "${cfg.stateDir}/socket" else "/run/${cfg.runtimeDir}"} || true - '' + toString cmd; + echo "${toString cmd}" + ls -l ${cfg.socketPath} || true + ${toString cmd} + ''; in { options = { services.cardano-node = { @@ -150,6 +152,14 @@ in { ''; }; + socketPath = mkOption { + type = types.str; + default = "${cfg.stateDir}/socket/node-core-${cfg.environment}.socket"; + description = '' + Socket that the node will be listening on + ''; + }; + databasePath = mkOption { type = types.str; default = "${cfg.stateDir}/${cfg.dbPrefix}"; diff --git a/nix/nixos/chairman-as-a-service.nix b/nix/nixos/chairman-as-a-service.nix index e5fc56cb47d..61695424a6e 100644 --- a/nix/nixos/chairman-as-a-service.nix +++ b/nix/nixos/chairman-as-a-service.nix @@ -11,7 +11,7 @@ let envConfig = environments.${cfg.environment}; mkChairmanConfig = nodeConfig: chairmanConfig: { inherit (nodeConfig) package genesisFile genesisHash stateDir pbftThreshold consensusProtocol; - inherit (chairmanConfig) timeout maxBlockNo k slot-length node-ids nodeConfigFile nodeConfig timeoutIsSuccess; + inherit (chairmanConfig) timeout maxBlockNo k slot-length socketPath node-ids nodeConfigFile nodeConfig timeoutIsSuccess; }; mkScript = cfg: let nodeIdArgs = builtins.toString @@ -26,7 +26,7 @@ let "--security-param ${toString cfg.k}" "--genesis-file ${cfg.genesisFile}" "--genesis-hash ${cfg.genesisHash}" - "--socket-path ${if (ncfg.runtimeDir == null) then "${ncfg.stateDir}/socket" else "/run/${ncfg.runtimeDir}"}" + "--socket-path ${cfg.socketPath}" "--config ${cfg.nodeConfigFile}" "${optionalString cfg.timeoutIsSuccess "--timeout-is-success"}" ]; @@ -107,6 +107,13 @@ in { default = 20; description = ''Duration of a slot, in seconds.''; }; + socketPath = mkOption { + type = types.str; + default = "${ncfg.stateDir}/socket/node-core-0.socket"; + description = '' + Socket that the chairman will be connect to + ''; + }; }; }; config = mkIf cfg.enable ( let stateDirBase = "/var/lib/"; in { diff --git a/nix/scripts.nix b/nix/scripts.nix index cf019911b17..9f124848178 100644 --- a/nix/scripts.nix +++ b/nix/scripts.nix @@ -20,7 +20,7 @@ let signingKey = null; delegationCertificate = null; nodeId = 0; - stateDir = "./"; + stateDir = "."; # defaults to proxy if env has no relays edgeHost = "127.0.0.1"; edgeNodes = []; diff --git a/nix/svclib.nix b/nix/svclib.nix index 1e23f16ef48..98791a63dd8 100644 --- a/nix/svclib.nix +++ b/nix/svclib.nix @@ -50,7 +50,7 @@ let }) topoSpec; }; in toFile "legacy-topology.json" (toJSON (mkTopo)); - + ## mkFullyConnectedLocalClusterTopology ## :: String Address -> String Port -> Int PortNo -> Int Valency ## -> Topology FilePath @@ -70,8 +70,7 @@ let mkShelleyNode = id: { nodeId = id; nodeAddress = { port = port-base + id; addr = addr-fn id; }; - producers = map (mkPeer) (remove id shelley-ids) ++ - [ { inherit valency; port = proxy-port; addr = proxy-addr; } ]; + producers = { inherit valency; port = proxy-port; addr = proxy-addr; } ; }; topology = map mkShelleyNode shelley-ids; in toFile "topology.yaml" (toJSON topology); @@ -226,7 +225,7 @@ let enable = true; legacy-node-count = 4; shelley-node-count = 3; - genesis-dir = "${../configuration/b0109}"; + genesis-dir = "${../configuration/c0c75}"; } ## NOTE: we do the above defaulting, so the following works, FWIW ## nix-build -A scripts.mainnet.chairman