|
1 |
| -{ self, ... }: { |
| 1 | +{ self, ... }: |
| 2 | +{ |
2 | 3 | name = "Test Cardano Dev Net";
|
3 | 4 |
|
4 | 5 | nodes =
|
5 | 6 | let
|
6 | 7 | # TODO(chfanghr): this *is* a nixosTest attribute in the new version of nixpkgs
|
7 |
| - defaults = { config, pkgs, lib, ... }: { |
8 |
| - imports = [ |
9 |
| - self.inputs.cardano-nix.nixosModules.default |
10 |
| - self.outputs.nixosModules.dev-net |
11 |
| - ]; |
| 8 | + defaults = |
| 9 | + { |
| 10 | + config, |
| 11 | + pkgs, |
| 12 | + lib, |
| 13 | + ... |
| 14 | + }: |
| 15 | + { |
| 16 | + imports = [ |
| 17 | + self.inputs.cardano-nix.nixosModules.default |
| 18 | + self.outputs.nixosModules.dev-net |
| 19 | + ]; |
12 | 20 |
|
13 |
| - services = { |
14 |
| - cardano-dev-net.enable = true; |
15 |
| - ogmios = { |
16 |
| - enable = true; |
17 |
| - nodeSocketPath = config.services.cardano-dev-net.socketPath; |
18 |
| - nodeConfigPath = config.services.cardano-dev-net.dynamicConfigFile; |
| 21 | + services = { |
| 22 | + cardano-dev-net.enable = true; |
| 23 | + ogmios = { |
| 24 | + enable = true; |
| 25 | + nodeSocketPath = config.services.cardano-dev-net.socketPath; |
| 26 | + nodeConfigPath = config.services.cardano-dev-net.dynamicConfigFile; |
| 27 | + }; |
19 | 28 | };
|
20 |
| - }; |
21 | 29 |
|
22 |
| - systemd.services.ogmios = |
23 |
| - let |
24 |
| - waitForOgmios = pkgs.writeShellScript "wait-for-ogmios" '' |
25 |
| - function is-listening { |
26 |
| - ${lib.getExe' pkgs.iproute2 "ss"} \ |
27 |
| - --no-header \ |
28 |
| - --numeric \ |
29 |
| - --listening \ |
30 |
| - --tcp src = ${config.services.ogmios.host} and sport = inet:${toString config.services.ogmios.port} | grep LISTEN |
31 |
| - } |
| 30 | + systemd.services.ogmios = |
| 31 | + let |
| 32 | + waitForOgmios = pkgs.writeShellScript "wait-for-ogmios" '' |
| 33 | + function is-listening { |
| 34 | + ${lib.getExe' pkgs.iproute2 "ss"} \ |
| 35 | + --no-header \ |
| 36 | + --numeric \ |
| 37 | + --listening \ |
| 38 | + --tcp src = ${config.services.ogmios.host} and sport = inet:${toString config.services.ogmios.port} | grep LISTEN |
| 39 | + } |
32 | 40 |
|
33 |
| - until is-listening; do sleep 10; done |
34 |
| - ''; |
35 |
| - in |
36 |
| - { |
37 |
| - after = [ "cardano-node-socket.service" ]; |
38 |
| - serviceConfig.RestrictAddressFamilies = [ "AF_NETLINK" ]; |
39 |
| - postStart = '' |
40 |
| - timeout 60 ${waitForOgmios} |
41 |
| - ''; |
42 |
| - }; |
43 |
| - }; |
| 41 | + until is-listening; do sleep 10; done |
| 42 | + ''; |
| 43 | + in |
| 44 | + { |
| 45 | + after = [ "cardano-node-socket.service" ]; |
| 46 | + serviceConfig.RestrictAddressFamilies = [ "AF_NETLINK" ]; |
| 47 | + postStart = '' |
| 48 | + timeout 60 ${waitForOgmios} |
| 49 | + ''; |
| 50 | + }; |
| 51 | + }; |
44 | 52 | in
|
45 | 53 | {
|
46 | 54 | machineWithNetworkMagic42 = {
|
|
0 commit comments