Skip to content

Commit f8b4139

Browse files
committed
flake: strip JSON5 comments from network-config.json
Nix does not know how to deal with JSON5, it's sad.
1 parent 65a2002 commit f8b4139

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

nix/tests/sable.nix

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,17 @@
33
let
44
inherit (pkgs) lib system;
55

6+
stripJSONComments = jsonFile: pkgs.runCommand "strip-json-comments" { } ''
7+
sed 's,//.*,,' ${jsonFile} > $out
8+
'';
69
deriveFingerprint = certFile: builtins.readFile (pkgs.runCommand "openssl-get-sha1-fp" ''
710
${lib.getExe pkgs.openssl} x509 -in ${certFile} -fingerprint -noout | sed 's/.*=//;s/://g;s/.*/Ł&/' > $out
811
'');
912
nodeConfig = { serverId, serverName, managementHostPort ? 8080, serverIP, caFile, managementClientCaFile, keyFile, certFile
1013
, bootstrapped ? false, peers ? null }: { ... }:
1114
let myFingerprint = ""; # deriveFingerprint certFile; # compute it
1215
in {
13-
imports = [
16+
imports = [
1417
sableModule
1518
];
1619

@@ -29,7 +32,7 @@ let
2932
enable = true;
3033
package = pkgs.sable-dev;
3134
network.bootstrap = if bootstrapped then
32-
(lib.importJSON ../../configs/network_config.json)
35+
(lib.importJSON (stripJSONComments ../../configs/network_config.json))
3336
else
3437
null;
3538
network.settings = {
@@ -143,7 +146,7 @@ in {
143146
'';
144147
};
145148

146-
basicMultiNodes =
149+
basicMultiNodes =
147150
let
148151
peers = [
149152
{

0 commit comments

Comments
 (0)