|
136 | 136 | type = types.str;
|
137 | 137 | default = "b4d587b3d3666d52df0cd43962080fd164568fe0@union-testnet.cor.systems:26656";
|
138 | 138 | };
|
139 |
| - node-key-file = mkOption { |
| 139 | + node-key-json = mkOption { |
140 | 140 | description = lib.mdDoc ''
|
141 | 141 | Path to a node_key.json file.
|
142 | 142 | '';
|
143 | 143 | example = "/run/secrets/node_key.json";
|
144 | 144 | type = types.nullOr types.path;
|
145 | 145 | default = null;
|
146 | 146 | };
|
147 |
| - priv-validator-key-file = mkOption { |
| 147 | + priv-validator-key-json = mkOption { |
148 | 148 | description = lib.mdDoc ''
|
149 | 149 | Path to a priv_validator_key.json file.
|
150 | 150 | '';
|
151 | 151 | example = "/run/secrets/priv_validator_key.json";
|
152 | 152 | type = types.nullOr types.path;
|
153 | 153 | default = null;
|
154 | 154 | };
|
| 155 | + app-toml = mkOption { |
| 156 | + description = lib.mdDoc '' |
| 157 | + Path to an app.toml file. |
| 158 | + ''; |
| 159 | + example = "/some/app.toml"; |
| 160 | + type = types.nullOr types.path; |
| 161 | + default = null; |
| 162 | + }; |
| 163 | + config-toml = mkOption { |
| 164 | + description = lib.mdDoc '' |
| 165 | + Path to an config.toml file. |
| 166 | + ''; |
| 167 | + example = "/some/config.toml"; |
| 168 | + type = types.nullOr types.path; |
| 169 | + default = null; |
| 170 | + }; |
| 171 | + client-toml = mkOption { |
| 172 | + description = lib.mdDoc '' |
| 173 | + Path to an client.toml file. |
| 174 | + ''; |
| 175 | + example = "/some/client.toml"; |
| 176 | + type = types.nullOr types.path; |
| 177 | + default = null; |
| 178 | + }; |
155 | 179 | };
|
156 | 180 |
|
157 | 181 | config = mkIf cfg.enable {
|
|
164 | 188 | unionvisor-systemd-script = pkgs.writeShellApplication {
|
165 | 189 | name = "unionvisor-systemd";
|
166 | 190 | runtimeInputs = [ pkgs.coreutils wrappedUnionvisor ];
|
167 |
| - text = '' |
168 |
| - ${pkgs.coreutils}/bin/mkdir -p /var/lib/unionvisor |
169 |
| - cd /var/lib/unionvisor |
170 |
| - unionvisor init --moniker ${cfg.moniker} --seeds ${cfg.seeds} --network ${cfg.network} --allow-dirty |
171 |
| -
|
172 |
| - '' |
173 |
| - |
174 |
| - # symlink node_key.json if supplied |
175 |
| - + (pkgs.lib.optionalString (cfg.node-key-file != null) |
176 |
| - '' |
177 |
| -
|
178 |
| - rm ./home/config/node_key.json |
179 |
| - ln -s ${cfg.node-key-file} ./home/config/node_key.json |
180 |
| -
|
181 |
| - '') |
182 |
| - |
183 |
| - # symlink priv_validator_key.json if supplied |
184 |
| - + (pkgs.lib.optionalString (cfg.priv-validator-key-file != null) |
| 191 | + text = |
| 192 | + let |
| 193 | + configSymlinks = [ |
| 194 | + { name = "node_key.json"; path = cfg.node-key-json; } |
| 195 | + { name = "priv_validator_key.json"; path = cfg.priv-validator-key-json; } |
| 196 | + { name = "app.toml"; path = cfg.app-toml; } |
| 197 | + { name = "client.toml"; path = cfg.client-toml; } |
| 198 | + { name = "config.toml"; path = cfg.config-toml; } |
| 199 | + ]; |
| 200 | + |
| 201 | + configSymLinkCommands = builtins.lib.concatMapStrings |
| 202 | + (l: |
| 203 | + '' |
| 204 | +
|
| 205 | + rm ./home/config/${l.name} |
| 206 | + ln -s ${l.path} ./home/config/${l.name} |
| 207 | +
|
| 208 | + '') |
| 209 | + (builtins.filter (l: l.path != null) configSymlinks); |
| 210 | + |
| 211 | + in |
185 | 212 | ''
|
| 213 | + ${pkgs.coreutils}/bin/mkdir -p /var/lib/unionvisor |
| 214 | + cd /var/lib/unionvisor |
| 215 | + unionvisor init --moniker ${cfg.moniker} --seeds ${cfg.seeds} --network ${cfg.network} --allow-dirty |
186 | 216 |
|
187 |
| - rm ./home/config/priv_validator_key.json |
188 |
| - ln -s ${cfg.priv-validator-key-file} ./home/config/priv_validator_key.json |
189 |
| - |
190 |
| - '') |
191 |
| - + |
192 |
| - '' |
| 217 | + ${configSymLinkCommands} |
193 | 218 |
|
194 |
| - unionvisor run |
195 |
| - ''; |
| 219 | + unionvisor run |
| 220 | + ''; |
196 | 221 | };
|
197 | 222 | in
|
198 | 223 | {
|
|
0 commit comments